mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 11:25:17 +00:00
test(EE API): add new entities to the default stage
This commit is contained in:
parent
588cbc9053
commit
d60e8097d9
@ -62,6 +62,12 @@ describeOnCondition(edition === 'EE')('Review workflows', () => {
|
|||||||
requests.admin = await createAuthRequest({ strapi });
|
requests.admin = await createAuthRequest({ strapi });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getRWMorphTableResults = async (connection) =>
|
||||||
|
connection
|
||||||
|
.select('*')
|
||||||
|
.from('strapi_workflows_stages_related_morphs')
|
||||||
|
.where('related_type', productUID);
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await builder.addContentTypes([model]).build();
|
await builder.addContentTypes([model]).build();
|
||||||
// eslint-disable-next-line node/no-extraneous-require
|
// eslint-disable-next-line node/no-extraneous-require
|
||||||
@ -319,12 +325,6 @@ describeOnCondition(edition === 'EE')('Review workflows', () => {
|
|||||||
describe('Enabling/Disabling review workflows on a content type', () => {
|
describe('Enabling/Disabling review workflows on a content type', () => {
|
||||||
let response;
|
let response;
|
||||||
|
|
||||||
const getRWMorphTableResults = async (connection) =>
|
|
||||||
connection
|
|
||||||
.select('*')
|
|
||||||
.from('strapi_workflows_stages_related_morphs')
|
|
||||||
.where('related_type', productUID);
|
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await createEntry(productUID, { name: 'Product' });
|
await createEntry(productUID, { name: 'Product' });
|
||||||
await createEntry(productUID, { name: 'Product 1' });
|
await createEntry(productUID, { name: 'Product 1' });
|
||||||
@ -373,4 +373,38 @@ describeOnCondition(edition === 'EE')('Review workflows', () => {
|
|||||||
expect(response.length).toEqual(0);
|
expect(response.length).toEqual(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Creating an entity in a review workflow content type', () => {
|
||||||
|
let response;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
await updateContentType(productUID, {
|
||||||
|
components: [],
|
||||||
|
contentType: { ...model, reviewWorkflows: true },
|
||||||
|
});
|
||||||
|
await restart();
|
||||||
|
|
||||||
|
await createEntry(productUID, { name: 'Product' });
|
||||||
|
await createEntry(productUID, { name: 'Product 1' });
|
||||||
|
await createEntry(productUID, { name: 'Product 2' });
|
||||||
|
});
|
||||||
|
|
||||||
|
test('when review workflows is enabled on a content type, new entries should be added to the first stage of the default workflow', async () => {
|
||||||
|
response = await requests.admin({
|
||||||
|
method: 'GET',
|
||||||
|
url: `/content-type-builder/content-types/api::product.product`,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(response.body.data.schema.reviewWorkflows).toBeTruthy();
|
||||||
|
|
||||||
|
response = await getRWMorphTableResults(strapi.db.getConnection());
|
||||||
|
|
||||||
|
expect(response.length).toEqual(6);
|
||||||
|
for (let i = 0; i < response.length; i += 1) {
|
||||||
|
const entry = response[i];
|
||||||
|
expect(entry.related_id).toEqual(i + 1);
|
||||||
|
expect(entry.order).toEqual(1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user