mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 10:55:37 +00:00
Fix tests
Signed-off-by: soupette <cyril@strapi.io>
This commit is contained in:
parent
45d39428df
commit
41d8a8d0bc
@ -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']);
|
||||
});
|
||||
});
|
||||
@ -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');
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user