fix: errors in tests

This commit is contained in:
chenos 2022-02-13 20:36:53 +08:00
parent ce3daba61d
commit ae43b1e99c
11 changed files with 73 additions and 71 deletions

View File

@ -1,7 +1,8 @@
import { render } from '@testing-library/react';
import React from 'react'; import React from 'react';
import { MemoryRouter } from 'react-router-dom'; import { MemoryRouter } from 'react-router-dom';
import { RouteSwitchProvider, RouteSwitch } from '../'; import { RouteSwitch } from '../RouteSwitch';
import { render } from '@testing-library/react'; import { RouteSwitchProvider } from '../RouteSwitchProvider';
const Home = () => <h1>Home</h1>; const Home = () => <h1>Home</h1>;
const About = () => <h1>About</h1>; const About = () => <h1>About</h1>;

View File

@ -1,6 +1,7 @@
export * from './antd';
export * from './context'; export * from './context';
export * from './hooks'; export * from './hooks';
export * from './RouteSwitch'; export * from './RouteSwitch';
export * from './RouteSwitchProvider'; export * from './RouteSwitchProvider';
export * from './types'; export * from './types';
export * from './antd';

View File

@ -1,8 +1,8 @@
import { formatMomentValue, usePrefixCls } from '@formily/antd/esm/__builtins__'; import { formatMomentValue, usePrefixCls } from '@formily/antd/lib/__builtins__';
import { isArr } from '@formily/shared'; import { isArr } from '@formily/shared';
import type { import type {
DatePickerProps as AntdDatePickerProps, DatePickerProps as AntdDatePickerProps,
RangePickerProps as AntdRangePickerProps, RangePickerProps as AntdRangePickerProps
} from 'antd/lib/date-picker'; } from 'antd/lib/date-picker';
import cls from 'classnames'; import cls from 'classnames';
import moment from 'moment'; import moment from 'moment';

View File

@ -1,5 +1,5 @@
import { formatMomentValue, momentable } from '@formily/antd/lib/__builtins__';
import type { DatePickerProps } from 'antd/lib/date-picker'; import type { DatePickerProps } from 'antd/lib/date-picker';
import { formatMomentValue, momentable } from '@formily/antd/esm/__builtins__';
export const getDefaultFormat = (props: DatePickerProps & { dateFormat: string; timeFormat: string }) => { export const getDefaultFormat = (props: DatePickerProps & { dateFormat: string; timeFormat: string }) => {
if (props.format) { if (props.format) {

View File

@ -1,4 +1,4 @@
import { usePrefixCls } from '@formily/antd/esm/__builtins__'; import { usePrefixCls } from '@formily/antd/lib/__builtins__';
import { Popover } from 'antd'; import { Popover } from 'antd';
import { InputProps, TextAreaProps } from 'antd/lib/input'; import { InputProps, TextAreaProps } from 'antd/lib/input';
import cls from 'classnames'; import cls from 'classnames';

View File

@ -1,4 +1,4 @@
import { formatMomentValue, usePrefixCls } from '@formily/antd/esm/__builtins__'; import { formatMomentValue, usePrefixCls } from '@formily/antd/lib/__builtins__';
import { isArr } from '@formily/shared'; import { isArr } from '@formily/shared';
import { TimeRangePickerProps } from 'antd/lib/time-picker'; import { TimeRangePickerProps } from 'antd/lib/time-picker';
import cls from 'classnames'; import cls from 'classnames';

View File

@ -1,4 +1,4 @@
import { formatMomentValue, momentable } from '@formily/antd/esm/__builtins__'; import { formatMomentValue, momentable } from '@formily/antd/lib/__builtins__';
import { connect, mapProps, mapReadPretty } from '@formily/react'; import { connect, mapProps, mapReadPretty } from '@formily/react';
import { TimePicker as AntdTimePicker } from 'antd'; import { TimePicker as AntdTimePicker } from 'antd';
import { TimePickerProps as AntdTimePickerProps, TimeRangePickerProps } from 'antd/lib/time-picker'; import { TimePickerProps as AntdTimePickerProps, TimeRangePickerProps } from 'antd/lib/time-picker';

View File

@ -1,4 +1,4 @@
import { usePrefixCls } from '@formily/antd/esm/__builtins__'; import { usePrefixCls } from '@formily/antd/lib/__builtins__';
import { Field } from '@formily/core'; import { Field } from '@formily/core';
import { observer, useField } from '@formily/react'; import { observer, useField } from '@formily/react';
import { isArr } from '@formily/shared'; import { isArr } from '@formily/shared';

View File

@ -1,7 +1,7 @@
import DeleteOutlined from '@ant-design/icons/DeleteOutlined'; import DeleteOutlined from '@ant-design/icons/DeleteOutlined';
import DownloadOutlined from '@ant-design/icons/DownloadOutlined'; import DownloadOutlined from '@ant-design/icons/DownloadOutlined';
import PlusOutlined from '@ant-design/icons/PlusOutlined'; import PlusOutlined from '@ant-design/icons/PlusOutlined';
import { usePrefixCls } from '@formily/antd/esm/__builtins__'; import { usePrefixCls } from '@formily/antd/lib/__builtins__';
import { connect, mapProps, mapReadPretty } from '@formily/react'; import { connect, mapProps, mapReadPretty } from '@formily/react';
import { Button, Progress, Space, Upload as AntdUpload } from 'antd'; import { Button, Progress, Space, Upload as AntdUpload } from 'antd';
import cls from 'classnames'; import cls from 'classnames';

View File

@ -1,7 +1,7 @@
import Koa from 'koa'; import Koa from 'koa';
import bodyParser from 'koa-bodyparser';
import supertest from 'supertest'; import supertest from 'supertest';
import Resourcer from '../resourcer'; import Resourcer from '../resourcer';
import bodyParser from 'koa-bodyparser';
describe('koa middleware', () => { describe('koa middleware', () => {
it('shound work', async () => { it('shound work', async () => {
@ -205,7 +205,7 @@ describe('koa middleware', () => {
other: 'other1', other: 'other1',
sort: '-id', sort: '-id',
}); });
expect(response.body).toEqual({ expect(response.body).toMatchObject({
sort: '-id', sort: '-id',
filter: { filter: {
$and: [ $and: [
@ -231,7 +231,7 @@ describe('koa middleware', () => {
}, },
}); });
const response = await agent.post('/tests').send({ aa: 'aa' }); const response = await agent.post('/tests').send({ aa: 'aa' });
expect(response.body).toEqual({ expect(response.body).toMatchObject({
actionName: 'create', actionName: 'create',
resourceName: 'tests', resourceName: 'tests',
values: { col1: 'val1', aa: 'aa' }, values: { col1: 'val1', aa: 'aa' },
@ -251,7 +251,7 @@ describe('koa middleware', () => {
const response = await agent.post('/resourcer/tests:create').send({ const response = await agent.post('/resourcer/tests:create').send({
values: { aa: 'aa' }, values: { aa: 'aa' },
}); });
expect(response.body).toEqual({ expect(response.body).toMatchObject({
actionName: 'create', actionName: 'create',
resourceName: 'tests', resourceName: 'tests',
values: { col1: 'val1', aa: 'aa' }, values: { col1: 'val1', aa: 'aa' },
@ -272,7 +272,7 @@ describe('koa middleware', () => {
resourceIndex: 1, resourceIndex: 1,
values: { aa: 'aa' }, values: { aa: 'aa' },
}); });
expect(response.body).toEqual({ expect(response.body).toMatchObject({
resourceIndex: 1, resourceIndex: 1,
actionName: 'update', actionName: 'update',
resourceName: 'tests', resourceName: 'tests',
@ -288,7 +288,7 @@ describe('koa middleware', () => {
}); });
it('get', async () => { it('get', async () => {
const response = await agent.get('/users/1/settings'); const response = await agent.get('/users/1/settings');
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'users', associatedName: 'users',
associatedIndex: '1', associatedIndex: '1',
resourceName: 'settings', resourceName: 'settings',
@ -297,7 +297,7 @@ describe('koa middleware', () => {
}); });
it('update', async () => { it('update', async () => {
const response = await agent.post('/users/1/settings'); const response = await agent.post('/users/1/settings');
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'users', associatedName: 'users',
associatedIndex: '1', associatedIndex: '1',
resourceName: 'settings', resourceName: 'settings',
@ -306,7 +306,7 @@ describe('koa middleware', () => {
}); });
it('destroy', async () => { it('destroy', async () => {
const response = await agent.delete('/users/1/settings'); const response = await agent.delete('/users/1/settings');
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'users', associatedName: 'users',
associatedIndex: '1', associatedIndex: '1',
resourceName: 'settings', resourceName: 'settings',
@ -323,7 +323,7 @@ describe('koa middleware', () => {
}); });
it('list', async () => { it('list', async () => {
const response = await agent.get('/users/1/posts'); const response = await agent.get('/users/1/posts');
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'users', associatedName: 'users',
associatedIndex: '1', associatedIndex: '1',
resourceName: 'posts', resourceName: 'posts',
@ -332,7 +332,7 @@ describe('koa middleware', () => {
}); });
it('get', async () => { it('get', async () => {
const response = await agent.get('/users/1/posts/1'); const response = await agent.get('/users/1/posts/1');
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'users', associatedName: 'users',
associatedIndex: '1', associatedIndex: '1',
resourceName: 'posts', resourceName: 'posts',
@ -342,7 +342,7 @@ describe('koa middleware', () => {
}); });
it('create', async () => { it('create', async () => {
const response = await agent.post('/users/1/posts'); const response = await agent.post('/users/1/posts');
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'users', associatedName: 'users',
associatedIndex: '1', associatedIndex: '1',
resourceName: 'posts', resourceName: 'posts',
@ -351,7 +351,7 @@ describe('koa middleware', () => {
}); });
it('update', async () => { it('update', async () => {
const response = await agent.put('/users/1/posts/1'); const response = await agent.put('/users/1/posts/1');
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'users', associatedName: 'users',
associatedIndex: '1', associatedIndex: '1',
resourceName: 'posts', resourceName: 'posts',
@ -361,7 +361,7 @@ describe('koa middleware', () => {
}); });
it('destroy', async () => { it('destroy', async () => {
const response = await agent.delete('/users/1/posts/1'); const response = await agent.delete('/users/1/posts/1');
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'users', associatedName: 'users',
associatedIndex: '1', associatedIndex: '1',
resourceName: 'posts', resourceName: 'posts',
@ -379,7 +379,7 @@ describe('koa middleware', () => {
}); });
it('get', async () => { it('get', async () => {
const response = await agent.get('/posts/1/user'); const response = await agent.get('/posts/1/user');
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'posts', associatedName: 'posts',
associatedIndex: '1', associatedIndex: '1',
resourceName: 'user', resourceName: 'user',
@ -388,7 +388,7 @@ describe('koa middleware', () => {
}); });
it('set', async () => { it('set', async () => {
const response = await agent.post('/posts/1/user/1'); const response = await agent.post('/posts/1/user/1');
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'posts', associatedName: 'posts',
associatedIndex: '1', associatedIndex: '1',
resourceName: 'user', resourceName: 'user',
@ -398,7 +398,7 @@ describe('koa middleware', () => {
}); });
it('remove', async () => { it('remove', async () => {
const response = await agent.delete('/posts/1/user'); const response = await agent.delete('/posts/1/user');
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'posts', associatedName: 'posts',
associatedIndex: '1', associatedIndex: '1',
resourceName: 'user', resourceName: 'user',
@ -415,7 +415,7 @@ describe('koa middleware', () => {
}); });
it('list', async () => { it('list', async () => {
const response = await agent.get('/posts/1/tags'); const response = await agent.get('/posts/1/tags');
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'posts', associatedName: 'posts',
associatedIndex: '1', associatedIndex: '1',
resourceName: 'tags', resourceName: 'tags',
@ -424,7 +424,7 @@ describe('koa middleware', () => {
}); });
it('get', async () => { it('get', async () => {
const response = await agent.get('/posts/1/tags/1'); const response = await agent.get('/posts/1/tags/1');
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'posts', associatedName: 'posts',
associatedIndex: '1', associatedIndex: '1',
resourceName: 'tags', resourceName: 'tags',
@ -434,7 +434,7 @@ describe('koa middleware', () => {
}); });
it('set', async () => { it('set', async () => {
const response = await agent.post('/posts/1/tags'); const response = await agent.post('/posts/1/tags');
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'posts', associatedName: 'posts',
associatedIndex: '1', associatedIndex: '1',
resourceName: 'tags', resourceName: 'tags',
@ -443,7 +443,7 @@ describe('koa middleware', () => {
}); });
it('add', async () => { it('add', async () => {
const response = await agent.post('/posts/1/tags/1'); const response = await agent.post('/posts/1/tags/1');
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'posts', associatedName: 'posts',
associatedIndex: '1', associatedIndex: '1',
resourceName: 'tags', resourceName: 'tags',
@ -453,7 +453,7 @@ describe('koa middleware', () => {
}); });
it('update', async () => { it('update', async () => {
const response = await agent.put('/posts/1/tags/1'); const response = await agent.put('/posts/1/tags/1');
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'posts', associatedName: 'posts',
associatedIndex: '1', associatedIndex: '1',
resourceName: 'tags', resourceName: 'tags',
@ -463,7 +463,7 @@ describe('koa middleware', () => {
}); });
it('remove', async () => { it('remove', async () => {
const response = await agent.delete('/posts/1/tags/1'); const response = await agent.delete('/posts/1/tags/1');
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'posts', associatedName: 'posts',
associatedIndex: '1', associatedIndex: '1',
resourceName: 'tags', resourceName: 'tags',
@ -482,7 +482,7 @@ describe('koa middleware', () => {
const response = await agent.get('/test1').query({ const response = await agent.get('/test1').query({
fields: ['id', 'col1'], fields: ['id', 'col1'],
}); });
expect(response.body).toEqual({ expect(response.body).toMatchObject({
actionName: 'list', actionName: 'list',
resourceName: 'test1', resourceName: 'test1',
fields: ['id', 'col1'], fields: ['id', 'col1'],
@ -500,7 +500,7 @@ describe('koa middleware', () => {
const response = await agent.get('/test1').query({ const response = await agent.get('/test1').query({
fields: ['id', 'col1'], fields: ['id', 'col1'],
}); });
expect(response.body).toEqual({ expect(response.body).toMatchObject({
actionName: 'list', actionName: 'list',
resourceName: 'test1', resourceName: 'test1',
fields: ['id'], fields: ['id'],
@ -518,7 +518,7 @@ describe('koa middleware', () => {
const response = await agent.get('/test1').query({ const response = await agent.get('/test1').query({
fields: ['id', 'col1', 'password'], fields: ['id', 'col1', 'password'],
}); });
expect(response.body).toEqual({ expect(response.body).toMatchObject({
actionName: 'list', actionName: 'list',
resourceName: 'test1', resourceName: 'test1',
fields: ['id', 'col1', 'password'], fields: ['id', 'col1', 'password'],
@ -538,7 +538,7 @@ describe('koa middleware', () => {
const response = await agent.get('/test1').query({ const response = await agent.get('/test1').query({
fields: ['id', 'col1', 'password', 'col2'], fields: ['id', 'col1', 'password', 'col2'],
}); });
expect(response.body).toEqual({ expect(response.body).toMatchObject({
actionName: 'list', actionName: 'list',
resourceName: 'test1', resourceName: 'test1',
fields: ['id', 'col1', 'password', 'col2'], fields: ['id', 'col1', 'password', 'col2'],
@ -559,7 +559,7 @@ describe('koa middleware', () => {
const response = await agent.get('/test1').query({ const response = await agent.get('/test1').query({
appends: ['relation1'], appends: ['relation1'],
}); });
expect(response.body).toEqual({ expect(response.body).toMatchObject({
actionName: 'list', actionName: 'list',
resourceName: 'test1', resourceName: 'test1',
except: ['password'], except: ['password'],
@ -576,7 +576,7 @@ describe('koa middleware', () => {
const response = await agent.get('/test1').query({ const response = await agent.get('/test1').query({
appends: 'rel1,rel2', appends: 'rel1,rel2',
}); });
expect(response.body).toEqual({ expect(response.body).toMatchObject({
actionName: 'list', actionName: 'list',
resourceName: 'test1', resourceName: 'test1',
appends: ['rel1', 'rel2'], appends: ['rel1', 'rel2'],
@ -592,7 +592,7 @@ describe('koa middleware', () => {
const response = await agent.get('/users/name/posts').query({ const response = await agent.get('/users/name/posts').query({
appends: 'rel1,rel2', appends: 'rel1,rel2',
}); });
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'users', associatedName: 'users',
associatedIndex: 'name', associatedIndex: 'name',
resourceName: 'posts', resourceName: 'posts',
@ -613,7 +613,7 @@ describe('koa middleware', () => {
}, },
}); });
const response = await agent.get('/users/name/posts'); const response = await agent.get('/users/name/posts');
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'users', associatedName: 'users',
associatedIndex: 'name', associatedIndex: 'name',
resourceName: 'posts', resourceName: 'posts',
@ -634,7 +634,7 @@ describe('koa middleware', () => {
}, },
}); });
const response = await agent.get('/users/name/posts'); const response = await agent.get('/users/name/posts');
expect(response.body).toEqual({ expect(response.body).toMatchObject({
associatedName: 'users', associatedName: 'users',
associatedIndex: 'name', associatedIndex: 'name',
resourceName: 'posts', resourceName: 'posts',

View File

@ -24,25 +24,25 @@ describe('utils', () => {
describe('parseFields', () => { describe('parseFields', () => {
it('plain string fields equal to only', () => { it('plain string fields equal to only', () => {
expect(parseFields('name,age')).toEqual({ expect(parseFields('name,age')).toMatchObject({
only: ['name', 'age'], only: ['name', 'age'],
}); });
}); });
it('plain array fields equal to only', () => { it('plain array fields equal to only', () => {
expect(parseFields(['name', 'age'])).toEqual({ expect(parseFields(['name', 'age'])).toMatchObject({
only: ['name', 'age'], only: ['name', 'age'],
}); });
}); });
it('only string fields equal to only', () => { it('only string fields equal to only', () => {
expect(parseFields({ only: 'name,age' })).toEqual({ expect(parseFields({ only: 'name,age' })).toMatchObject({
only: ['name', 'age'], only: ['name', 'age'],
}); });
}); });
it('only array fields equal to only', () => { it('only array fields equal to only', () => {
expect(parseFields({ only: ['name', 'age'] })).toEqual({ expect(parseFields({ only: ['name', 'age'] })).toMatchObject({
only: ['name', 'age'], only: ['name', 'age'],
}); });
}); });
@ -50,7 +50,7 @@ describe('utils', () => {
it('plain only and expect fields', () => { it('plain only and expect fields', () => {
// input as "fields=title&fields[only]=content&fields[except]=status&fields[except]=created_at" // input as "fields=title&fields[only]=content&fields[except]=status&fields[except]=created_at"
const result = parseFields(['title', { only: 'content' }, { except: ['status', 'created_at'] }]); const result = parseFields(['title', { only: 'content' }, { except: ['status', 'created_at'] }]);
expect(result).toEqual({ expect(result).toMatchObject({
only: ['title', 'content'], only: ['title', 'content'],
except: ['status', 'created_at'], except: ['status', 'created_at'],
}); });
@ -60,11 +60,11 @@ describe('utils', () => {
describe('mergeFields', () => { describe('mergeFields', () => {
describe('empty default', () => { describe('empty default', () => {
it('always contains "appends"', async () => { it('always contains "appends"', async () => {
expect(mergeFields({}, { only: ['col'] })).toEqual({ appends: [], only: ['col'] }); expect(mergeFields({}, { only: ['col'] })).toMatchObject({ appends: [], only: ['col'] });
}); });
it('appends', async () => { it('appends', async () => {
expect(mergeFields({}, { only: ['col1'], appends: ['col2'] })).toEqual({ only: ['col1'], appends: ['col2'] }); expect(mergeFields({}, { only: ['col1'], appends: ['col2'] })).toMatchObject({ only: ['col1'], appends: ['col2'] });
}); });
}); });
@ -83,7 +83,7 @@ describe('utils', () => {
appends: ['col6'], appends: ['col6'],
}, },
), ),
).toEqual({ ).toMatchObject({
only: ['col1'], only: ['col1'],
appends: ['col6', 'col4'], appends: ['col6', 'col4'],
}); });
@ -97,7 +97,7 @@ describe('utils', () => {
path: '/posts', path: '/posts',
method: 'GET', method: 'GET',
}); });
expect(params).toEqual({ resourceName: 'posts', actionName: 'list' }); expect(params).toMatchObject({ resourceName: 'posts', actionName: 'list' });
}); });
it('store action', () => { it('store action', () => {
@ -105,7 +105,7 @@ describe('utils', () => {
path: '/posts', path: '/posts',
method: 'POST', method: 'POST',
}); });
expect(params).toEqual({ resourceName: 'posts', actionName: 'create' }); expect(params).toMatchObject({ resourceName: 'posts', actionName: 'create' });
}); });
it('get action', () => { it('get action', () => {
@ -113,7 +113,7 @@ describe('utils', () => {
path: '/posts/1', path: '/posts/1',
method: 'GET', method: 'GET',
}); });
expect(params).toEqual({ resourceName: 'posts', resourceIndex: '1', actionName: 'get' }); expect(params).toMatchObject({ resourceName: 'posts', resourceIndex: '1', actionName: 'get' });
}); });
it('update action', () => { it('update action', () => {
@ -121,7 +121,7 @@ describe('utils', () => {
path: '/posts/1', path: '/posts/1',
method: 'PUT', method: 'PUT',
}); });
expect(params).toEqual({ resourceName: 'posts', resourceIndex: '1', actionName: 'update' }); expect(params).toMatchObject({ resourceName: 'posts', resourceIndex: '1', actionName: 'update' });
}); });
it('update action', () => { it('update action', () => {
@ -129,7 +129,7 @@ describe('utils', () => {
path: '/posts/1', path: '/posts/1',
method: 'PATCH', method: 'PATCH',
}); });
expect(params).toEqual({ resourceName: 'posts', resourceIndex: '1', actionName: 'update' }); expect(params).toMatchObject({ resourceName: 'posts', resourceIndex: '1', actionName: 'update' });
}); });
it('delete action', () => { it('delete action', () => {
@ -137,7 +137,7 @@ describe('utils', () => {
path: '/posts/1', path: '/posts/1',
method: 'delete', method: 'delete',
}); });
expect(params).toEqual({ resourceName: 'posts', resourceIndex: '1', actionName: 'destroy' }); expect(params).toMatchObject({ resourceName: 'posts', resourceIndex: '1', actionName: 'destroy' });
}); });
it('delete action', () => { it('delete action', () => {
@ -145,7 +145,7 @@ describe('utils', () => {
path: '/posts/1,2,3,4,5,6', path: '/posts/1,2,3,4,5,6',
method: 'delete', method: 'delete',
}); });
expect(params).toEqual({ resourceName: 'posts', resourceIndex: '1,2,3,4,5,6', actionName: 'destroy' }); expect(params).toMatchObject({ resourceName: 'posts', resourceIndex: '1,2,3,4,5,6', actionName: 'destroy' });
}); });
it('index action', () => { it('index action', () => {
@ -153,7 +153,7 @@ describe('utils', () => {
path: '/posts/1/comments', path: '/posts/1/comments',
method: 'GET', method: 'GET',
}); });
expect(params).toEqual({ expect(params).toMatchObject({
resourceName: 'comments', resourceName: 'comments',
associatedName: 'posts', associatedName: 'posts',
associatedIndex: '1', associatedIndex: '1',
@ -166,7 +166,7 @@ describe('utils', () => {
path: '/posts/1/comments', path: '/posts/1/comments',
method: 'POST', method: 'POST',
}); });
expect(params).toEqual({ expect(params).toMatchObject({
resourceName: 'comments', resourceName: 'comments',
associatedName: 'posts', associatedName: 'posts',
associatedIndex: '1', associatedIndex: '1',
@ -179,7 +179,7 @@ describe('utils', () => {
path: '/posts/1/comments/1', path: '/posts/1/comments/1',
method: 'GET', method: 'GET',
}); });
expect(params).toEqual({ expect(params).toMatchObject({
resourceName: 'comments', resourceName: 'comments',
resourceIndex: '1', resourceIndex: '1',
associatedName: 'posts', associatedName: 'posts',
@ -193,7 +193,7 @@ describe('utils', () => {
path: '/posts/1/comments/1', path: '/posts/1/comments/1',
method: 'PUT', method: 'PUT',
}); });
expect(params).toEqual({ expect(params).toMatchObject({
resourceName: 'comments', resourceName: 'comments',
resourceIndex: '1', resourceIndex: '1',
associatedName: 'posts', associatedName: 'posts',
@ -207,7 +207,7 @@ describe('utils', () => {
path: '/posts/1/comments/1', path: '/posts/1/comments/1',
method: 'PATCH', method: 'PATCH',
}); });
expect(params).toEqual({ expect(params).toMatchObject({
resourceName: 'comments', resourceName: 'comments',
resourceIndex: '1', resourceIndex: '1',
associatedName: 'posts', associatedName: 'posts',
@ -221,7 +221,7 @@ describe('utils', () => {
path: '/posts/1/comments/1', path: '/posts/1/comments/1',
method: 'delete', method: 'delete',
}); });
expect(params).toEqual({ expect(params).toMatchObject({
resourceName: 'comments', resourceName: 'comments',
resourceIndex: '1', resourceIndex: '1',
associatedName: 'posts', associatedName: 'posts',
@ -235,7 +235,7 @@ describe('utils', () => {
path: '/posts:export', path: '/posts:export',
method: 'GET', method: 'GET',
}); });
expect(params).toEqual({ resourceName: 'posts', actionName: 'export' }); expect(params).toMatchObject({ resourceName: 'posts', actionName: 'export' });
}); });
it('export action', () => { it('export action', () => {
@ -243,7 +243,7 @@ describe('utils', () => {
path: '/posts:export', path: '/posts:export',
method: 'POST', method: 'POST',
}); });
expect(params).toEqual({ resourceName: 'posts', actionName: 'export' }); expect(params).toMatchObject({ resourceName: 'posts', actionName: 'export' });
}); });
it('export action', () => { it('export action', () => {
@ -251,7 +251,7 @@ describe('utils', () => {
path: '/posts:export/1', path: '/posts:export/1',
method: 'POST', method: 'POST',
}); });
expect(params).toEqual({ resourceName: 'posts', resourceIndex: '1', actionName: 'export' }); expect(params).toMatchObject({ resourceName: 'posts', resourceIndex: '1', actionName: 'export' });
}); });
it('attach action', () => { it('attach action', () => {
@ -259,7 +259,7 @@ describe('utils', () => {
path: '/posts/1/tags:attach/2', path: '/posts/1/tags:attach/2',
method: 'POST', method: 'POST',
}); });
expect(params).toEqual({ expect(params).toMatchObject({
resourceName: 'tags', resourceName: 'tags',
resourceIndex: '2', resourceIndex: '2',
associatedIndex: '1', associatedIndex: '1',
@ -278,7 +278,7 @@ describe('utils', () => {
prefix: '/api', prefix: '/api',
}, },
); );
expect(params).toEqual({ resourceName: 'posts', actionName: 'list' }); expect(params).toMatchObject({ resourceName: 'posts', actionName: 'list' });
}); });
it('prefix options', () => { it('prefix options', () => {
@ -306,7 +306,7 @@ describe('utils', () => {
}, },
}, },
); );
expect(params).toEqual({ resourceName: 'posts', actionName: 'query' }); expect(params).toMatchObject({ resourceName: 'posts', actionName: 'query' });
}); });
it('actions options', () => { it('actions options', () => {
@ -314,7 +314,7 @@ describe('utils', () => {
path: '/posts:list', path: '/posts:list',
method: 'GET', method: 'GET',
}); });
expect(params).toEqual({ resourceName: 'posts', actionName: 'list' }); expect(params).toMatchObject({ resourceName: 'posts', actionName: 'list' });
}); });
it('actions options', () => { it('actions options', () => {
@ -322,7 +322,7 @@ describe('utils', () => {
path: '/resourcer/user.posts:list', path: '/resourcer/user.posts:list',
method: 'GET', method: 'GET',
}); });
expect(params).toEqual({ associatedName: 'user', resourceName: 'posts', actionName: 'list' }); expect(params).toMatchObject({ associatedName: 'user', resourceName: 'posts', actionName: 'list' });
}); });
}); });
}); });