Fix tests

Signed-off-by: soupette <cyril@strapi.io>
This commit is contained in:
soupette 2021-09-15 09:50:28 +02:00
parent 45d39428df
commit 41d8a8d0bc
2 changed files with 0 additions and 67 deletions

View File

@ -1,21 +0,0 @@
import getAllAllowedHeaders from '../getAllAllowedHeaders';
describe('CONTENT MANAGER | containers | ListView | utils | getAllAllowedHeaders', () => {
it('should return a sorted array containing all the displayed fields', () => {
const attributes = {
addresse: {
type: 'relation',
relationType: 'morph',
},
test: {
type: 'string',
},
first: {
type: 'relation',
relationType: 'manyToMany',
},
};
expect(getAllAllowedHeaders(attributes)).toEqual(['first', 'test']);
});
});

View File

@ -1,46 +0,0 @@
import getFirstSortableHeader from '../getFirstSortableHeader';
describe('CONTENT MANAGER | containers | ListView | utils | getFirstSortableHeader', () => {
it('should return id if the array is empty', () => {
expect(getFirstSortableHeader([])).toEqual('id');
});
it('should return the first sortable element', () => {
const headers = [
{
name: 'un',
metadatas: { sortable: false },
},
{
name: 'two',
metadatas: { sortable: true },
},
{
name: 'three',
metadatas: { sortable: true },
},
];
expect(getFirstSortableHeader(headers)).toBe('two');
});
it('should return the first sortable element if it is a relation', () => {
const headers = [
{
name: 'un',
metadatas: { sortable: false },
},
{
name: 'two',
fieldSchema: { type: 'relation' },
metadatas: { sortable: true, mainField: 'test' },
},
{
name: 'three',
metadatas: { sortable: true },
},
];
expect(getFirstSortableHeader(headers)).toBe('two.test');
});
});