const models = require('vn-loopback/server/server').models;

describe('userConfig getUserConfig()', () => {
    it(`should return the configuration data of a given user`, async() => {
        const tx = await models.Item.beginTransaction({});
        const options = {transaction: tx};

        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;
        }
    });
});