30 lines
911 B
JavaScript
30 lines
911 B
JavaScript
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();
|
|
});
|
|
});
|