mirror of
https://github.com/strapi/strapi.git
synced 2025-08-29 19:22:24 +00:00
chore: run relation permissions test (#20674)
This commit is contained in:
parent
0694fe6c8f
commit
8ad1ccbb99
@ -88,8 +88,7 @@ const createUserAndReq = async (userName, permissions) => {
|
|||||||
return rq;
|
return rq;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: Fix relations
|
describe('Relation permissions', () => {
|
||||||
describe.skip('Relations', () => {
|
|
||||||
const builder = createTestBuilder();
|
const builder = createTestBuilder();
|
||||||
|
|
||||||
const createFixtures = async () => {
|
const createFixtures = async () => {
|
||||||
@ -130,12 +129,16 @@ describe.skip('Relations', () => {
|
|||||||
rq = await createAuthRequest({ strapi });
|
rq = await createAuthRequest({ strapi });
|
||||||
await createFixtures();
|
await createFixtures();
|
||||||
|
|
||||||
product = await createEntry('api::product.product', { name: 'Skate' });
|
const productEntry = await createEntry('api::product.product', { name: 'Skate' });
|
||||||
shop = await createEntry(
|
product = productEntry.data;
|
||||||
|
|
||||||
|
const shopEntry = await createEntry(
|
||||||
'api::shop.shop',
|
'api::shop.shop',
|
||||||
{ name: 'Shop', products: [product.id] },
|
{ name: 'Shop', products: [product.id] },
|
||||||
populateShop
|
populateShop
|
||||||
);
|
);
|
||||||
|
shop = shopEntry.data;
|
||||||
|
|
||||||
user = await createEntry('plugin::users-permissions.user', {
|
user = await createEntry('plugin::users-permissions.user', {
|
||||||
username: 'Alice',
|
username: 'Alice',
|
||||||
email: 'test-relations@strapi.io',
|
email: 'test-relations@strapi.io',
|
||||||
@ -154,7 +157,7 @@ describe.skip('Relations', () => {
|
|||||||
rqPermissive,
|
rqPermissive,
|
||||||
'api::shop.shop',
|
'api::shop.shop',
|
||||||
'products',
|
'products',
|
||||||
shop.id
|
shop.documentId
|
||||||
);
|
);
|
||||||
|
|
||||||
// Main field should be in here
|
// Main field should be in here
|
||||||
@ -168,7 +171,7 @@ describe.skip('Relations', () => {
|
|||||||
rqRestricted,
|
rqRestricted,
|
||||||
'api::shop.shop',
|
'api::shop.shop',
|
||||||
'products',
|
'products',
|
||||||
shop.id
|
shop.documentId
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(products.results).toHaveLength(1);
|
expect(products.results).toHaveLength(1);
|
||||||
@ -186,10 +189,10 @@ describe.skip('Relations', () => {
|
|||||||
rqRestricted,
|
rqRestricted,
|
||||||
'plugin::users-permissions.user',
|
'plugin::users-permissions.user',
|
||||||
'role',
|
'role',
|
||||||
user.id
|
user.documentId
|
||||||
);
|
);
|
||||||
|
|
||||||
// Main field should be visible
|
// Main field should be visible
|
||||||
expect(role.data?.name).toBe('Authenticated');
|
expect(role.results?.[0].name).toBe('Authenticated');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user