mirror of
https://github.com/strapi/strapi.git
synced 2025-09-18 04:47:27 +00:00
38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
const _ = require('lodash');
|
|
|
|
const { createAuthRequest } = require('../../../test/helpers/request');
|
|
const { createStrapiInstance } = require('../../../test/helpers/strapi');
|
|
|
|
describe('Role CRUD End to End', () => {
|
|
let rq;
|
|
let strapi;
|
|
|
|
beforeAll(async () => {
|
|
strapi = await createStrapiInstance();
|
|
rq = await createAuthRequest({ strapi });
|
|
}, 60000);
|
|
|
|
afterAll(async () => {
|
|
await strapi.destroy();
|
|
});
|
|
|
|
test('Can get the existing permissions', async () => {
|
|
let res = await rq({
|
|
url: '/admin/permissions',
|
|
method: 'GET',
|
|
});
|
|
|
|
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(sortedData).toMatchSnapshot();
|
|
});
|
|
});
|