2021-07-12 10:50:15 +00:00
|
|
|
const models = require('vn-loopback/server/server').models;
|
2018-10-08 09:03:28 +00:00
|
|
|
|
|
|
|
describe('userConfig getUserConfig()', () => {
|
|
|
|
it(`should return the configuration data of a given user`, async() => {
|
2021-07-12 10:50:15 +00:00
|
|
|
const tx = await models.Item.beginTransaction({});
|
|
|
|
const options = {transaction: tx};
|
2021-05-25 07:25:22 +00:00
|
|
|
|
2021-07-12 10:50:15 +00:00
|
|
|
try {
|
|
|
|
const ctx = {req: {accessToken: {userId: 9}}};
|
|
|
|
const result = await models.UserConfig.getUserConfig(ctx, options);
|
|
|
|
|
|
|
|
expect(result.warehouseFk).toEqual(1);
|
|
|
|
expect(result.companyFk).toEqual(442);
|
|
|
|
|
|
|
|
await tx.rollback();
|
|
|
|
} catch (e) {
|
|
|
|
await tx.rollback();
|
|
|
|
throw e;
|
|
|
|
}
|
2018-10-08 09:03:28 +00:00
|
|
|
});
|
|
|
|
});
|