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

30 lines
890 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';
2024-03-21 09:18:54 +00:00
const appNameVersion = '9.2';
const appNameVersionBeta = '9.7';
2024-03-14 07:36:19 +00:00
beforeAll(async() => {
ctx = {
req: {
accessToken: {},
headers: {origin: 'http://localhost'},
}
};
});
it('should get the version app', async() => {
ctx.req.accessToken.userId = 9;
2024-03-21 09:18:54 +00:00
const {version} = await models.MobileAppVersionControl.getVersion(ctx, appName);
2024-03-14 07:36:19 +00:00
2024-03-21 09:18:54 +00:00
expect(version).toEqual(appNameVersion);
2024-03-14 07:36:19 +00:00
});
it('should get the beta version app', async() => {
ctx.req.accessToken.userId = 66;
2024-03-21 09:18:54 +00:00
const {version} = await models.MobileAppVersionControl.getVersion(ctx, appName);
2024-03-14 07:36:19 +00:00
2024-03-21 09:18:54 +00:00
expect(version).toEqual(appNameVersionBeta);
2024-03-14 07:36:19 +00:00
});
});