salix/back/methods/mobile-app-version-control/specs/getVersion.spec.js

30 lines
911 B
JavaScript
Raw Normal View History

2024-03-14 07:36:19 +00:00
const {models} = require('vn-loopback/server/server');
describe('mobileAppVersionControl getVersion()', () => {
const appName = 'delivery';
beforeAll(async() => {
ctx = {
req: {
accessToken: {},
headers: {origin: 'http://localhost'},
}
};
});
it('should get the version app', async() => {
ctx.req.accessToken.userId = 9;
const {version, versionBeta} = await models.MobileAppVersionControl.getVersion(ctx, appName);
expect(version).toEqual('9.2');
expect(versionBeta).toBeUndefined();
});
it('should get the beta version app', async() => {
ctx.req.accessToken.userId = 66;
const {version, versionBeta} = await models.MobileAppVersionControl.getVersion(ctx, appName);
expect(versionBeta).toBeDefined();
expect(version).toBeUndefined();
});
});