mirror of
https://github.com/qlik-oss/nebula.js.git
synced 2025-12-19 17:58:43 -05:00
feat: allow mocking of getListObject (#1745)
This commit is contained in:
committed by
GitHub
parent
bfb15f5eb1
commit
72fef8889f
@@ -341,4 +341,28 @@ describe('enigma-mocker', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('getListObject', () => {
|
||||
test('should return a model that maps to corresponding genericObject', async () => {
|
||||
const app = await createEnigmaMocker([
|
||||
{
|
||||
getLayout: {
|
||||
qInfo: { qId: 'TestList' },
|
||||
qAppObjectList: {
|
||||
qItems: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
const listObjectModel = await app.getListObject({ qInfo: { qId: 'TestList' } });
|
||||
expect(listObjectModel.id).toEqual('TestList');
|
||||
});
|
||||
|
||||
test('should return undefined if no mock exist', async () => {
|
||||
const app = await createEnigmaMocker(genericObjects);
|
||||
const listObjectModel = await app.getListObject({ qInfo: { qId: 'TestList' } });
|
||||
expect(listObjectModel).toBe(undefined);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -16,7 +16,7 @@ export default function fromGenericObjects(genericObjects, options = {}) {
|
||||
destroySessionObject: async () => {},
|
||||
getObject,
|
||||
getAppLayout,
|
||||
getListObject: async () => {},
|
||||
getListObject: async (props) => getObject(props.qInfo?.qId),
|
||||
};
|
||||
|
||||
return Promise.resolve(app);
|
||||
|
||||
Reference in New Issue
Block a user