mirror of
https://github.com/strapi/strapi.git
synced 2025-10-17 11:08:14 +00:00
fix: populate syntax in media test
Co-authored-by: Jean-Sébastien Herbaux <Convly@users.noreply.github.com>
This commit is contained in:
parent
ff5a4cf03b
commit
4fe3c1b4c4
@ -176,6 +176,8 @@ const populate = traverseFactory()
|
||||
const newValue = await recurse(visitor, { schema, path, getModel }, { on: value?.on });
|
||||
|
||||
set(key, { on: newValue });
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const targetSchemaUID = attribute.target;
|
||||
|
@ -21,7 +21,9 @@ const schemas = {
|
||||
singularName: 'a',
|
||||
pluralName: 'as',
|
||||
attributes: {
|
||||
cover: { type: 'media' },
|
||||
cover: {
|
||||
type: 'media',
|
||||
},
|
||||
},
|
||||
},
|
||||
b: {
|
||||
@ -143,9 +145,13 @@ describe('Sanitize populated entries', () => {
|
||||
|
||||
test("Media's relations (from related) can be populated without restricted attributes", async () => {
|
||||
const { status, body } = await contentAPIRequest.get(`/upload/files/${file.id}`, {
|
||||
qs: { populate: { related: { populate: '*' } } },
|
||||
qs: {
|
||||
populate: {
|
||||
related: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
console.log(body);
|
||||
expect(status).toBe(200);
|
||||
expect(body.related).toBeDefined();
|
||||
expect(Array.isArray(body.related)).toBeTruthy();
|
||||
@ -170,7 +176,10 @@ describe('Sanitize populated entries', () => {
|
||||
});
|
||||
|
||||
const { status } = await contentAPIRequest.get(`/${schemas.contentTypes.b.pluralName}`, {
|
||||
qs: { fields: ['id'], populate: '*' },
|
||||
qs: {
|
||||
fields: ['id'],
|
||||
populate: '*',
|
||||
},
|
||||
});
|
||||
|
||||
expect(status).toBe(200);
|
||||
|
Loading…
x
Reference in New Issue
Block a user