30 lines
890 B
JavaScript
30 lines
890 B
JavaScript
const {models} = require('vn-loopback/server/server');
|
|
|
|
describe('mobileAppVersionControl getVersion()', () => {
|
|
const appName = 'delivery';
|
|
const appNameVersion = '9.2';
|
|
const appNameVersionBeta = '9.7';
|
|
beforeAll(async() => {
|
|
ctx = {
|
|
req: {
|
|
accessToken: {},
|
|
headers: {origin: 'http://localhost'},
|
|
}
|
|
};
|
|
});
|
|
|
|
it('should get the version app', async() => {
|
|
ctx.req.accessToken.userId = 9;
|
|
const {version} = await models.MobileAppVersionControl.getVersion(ctx, appName);
|
|
|
|
expect(version).toEqual(appNameVersion);
|
|
});
|
|
|
|
it('should get the beta version app', async() => {
|
|
ctx.req.accessToken.userId = 66;
|
|
const {version} = await models.MobileAppVersionControl.getVersion(ctx, appName);
|
|
|
|
expect(version).toEqual(appNameVersionBeta);
|
|
});
|
|
});
|