mirror of
https://github.com/strapi/strapi.git
synced 2025-08-05 15:29:04 +00:00
check if there are no components
This commit is contained in:
parent
2200f279ab
commit
6f76aee4d7
@ -3,11 +3,6 @@
|
||||
const createEntityService = require('..');
|
||||
const entityValidator = require('../../entity-validator');
|
||||
|
||||
jest.mock('../components', () => ({
|
||||
...jest.requireActual('../components'),
|
||||
getComponents: jest.fn(),
|
||||
}));
|
||||
|
||||
describe('Entity service triggers webhooks', () => {
|
||||
global.strapi = {
|
||||
getModel: () => ({}),
|
||||
|
@ -104,10 +104,12 @@ const createComponents = async (uid, data) => {
|
||||
/**
|
||||
* @param {str} uid
|
||||
* @param {object} entity
|
||||
* @return {Promise<{uid: string, entity: object}[]>}
|
||||
* @return {Promise<{uid: string, entity: object}>}
|
||||
*/
|
||||
const getComponents = async (uid, entity) => {
|
||||
const componentAttributes = getComponentAttributes(strapi.getModel(uid));
|
||||
|
||||
if (_.isEmpty(componentAttributes)) return {};
|
||||
return strapi.query(uid).load(entity, componentAttributes);
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user