mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 16:29:34 +00:00
Merge pull request #1 from Boegie19/i18n-entity-service-wrapParams
I18n entity service wrap params
This commit is contained in:
commit
8b6cad699b
@ -45,6 +45,8 @@ const models = {
|
||||
'localized-single-type-model': singleTypeModel,
|
||||
};
|
||||
|
||||
const testModels = [['test-model'], ['non-localized-model'], ['localized-single-type-model']];
|
||||
|
||||
describe('Entity service decorator', () => {
|
||||
beforeAll(() => {
|
||||
global.strapi = {
|
||||
@ -139,6 +141,16 @@ describe('Entity service decorator', () => {
|
||||
['delete', { filters: [{ id: { $in: [1] } }] }],
|
||||
];
|
||||
|
||||
test.each(testModels)('Always uses original wrapParams in output - %s', async (modelName) => {
|
||||
const defaultService = {
|
||||
wrapParams: jest.fn(() => Promise.resolve({ Test: 'Test' })),
|
||||
};
|
||||
const service = decorator(defaultService);
|
||||
|
||||
const output = await service.wrapParams({}, { uid: modelName, action: 'findMany' });
|
||||
|
||||
expect(output.Test).toEqual('Test');
|
||||
});
|
||||
test.each(testData)(
|
||||
"Doesn't add locale param when the params contain id or id_in - %s",
|
||||
async (action, params) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user