mirror of
https://github.com/strapi/strapi.git
synced 2025-12-29 08:04:51 +00:00
fix tests
Signed-off-by: Pierre Noël <petersg83@gmail.com>
This commit is contained in:
parent
3aec039698
commit
2339c6b8f7
@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const _ = require('lodash');
|
||||
|
||||
const { registerAndLogin } = require('../../../test/helpers/auth');
|
||||
const { createAuthRequest } = require('../../../test/helpers/request');
|
||||
|
||||
@ -18,6 +20,13 @@ describe('Role CRUD End to End', () => {
|
||||
});
|
||||
|
||||
expect(res.statusCode).toBe(200);
|
||||
|
||||
// Data is sorted to avoid error with snapshot when the data is not in the same order
|
||||
const sortedData = _.cloneDeep(res.body.data);
|
||||
Object.keys(sortedData.sections).forEach(sectionName => {
|
||||
sortedData.sections[sectionName] = _.sortBy(sortedData.sections[sectionName], ['action']);
|
||||
});
|
||||
sortedData.conditions = sortedData.conditions.sort();
|
||||
expect(res.body.data).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
@ -6,17 +6,28 @@
|
||||
const { registerAndLogin } = require('../../../test/helpers/auth');
|
||||
const { createAuthRequest } = require('../../../test/helpers/request');
|
||||
const waitRestart = require('../../../test/helpers/waitRestart');
|
||||
const createModelsUtils = require('../../../test/helpers/models');
|
||||
|
||||
let rq;
|
||||
let modelsUtils;
|
||||
|
||||
describe('Content Type Builder - Content types', () => {
|
||||
beforeAll(async () => {
|
||||
const token = await registerAndLogin();
|
||||
rq = createAuthRequest(token);
|
||||
modelsUtils = createModelsUtils({ rq });
|
||||
}, 60000);
|
||||
|
||||
afterEach(() => waitRestart());
|
||||
|
||||
afterAll(async () => {
|
||||
await modelsUtils.deleteContentTypes([
|
||||
'test-collection-type',
|
||||
'test-collection',
|
||||
'test-single-type',
|
||||
]);
|
||||
}, 60000);
|
||||
|
||||
describe('Collection Types', () => {
|
||||
const collectionTypeUID = 'application::test-collection-type.test-collection-type';
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user