salix/back/methods/starred-module/specs/getStarredModules.spec.js

17 lines
612 B
JavaScript
Raw Permalink Normal View History

2023-01-24 08:04:43 +00:00
const {models} = require('vn-loopback/server/server');
describe('getStarredModules()', () => {
2024-06-14 06:39:57 +00:00
const ctx = beforeAll.getCtx();
it(`should return the starred modules for a given user`, async() => {
2023-01-24 08:04:43 +00:00
const newStarred = await models.StarredModule.create({workerFk: 9, moduleFk: 'customer', position: 1});
const starredModules = await models.StarredModule.getStarredModules(ctx);
expect(starredModules.length).toEqual(1);
2022-12-14 13:20:41 +00:00
expect(starredModules[0].moduleFk).toEqual('customer');
// restores
2023-01-24 08:04:43 +00:00
await models.StarredModule.destroyById(newStarred.id);
});
});