feat: refs #6276 test getVersion
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-01-18 14:18:21 +01:00
parent d41d57143f
commit 19edd7868e
3 changed files with 34 additions and 3 deletions

View File

@ -0,0 +1,29 @@
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() => {
const {version, versionBeta} = await models.MobileAppVersionControl.getVersion(ctx, appName);
ctx.req.accessToken.userId = 66;
expect(versionBeta).toBeDefined();
expect(version).toBeUndefined();
});
});

View File

@ -2716,10 +2716,10 @@ INSERT INTO `vn`.`chat` (`senderFk`, `recipient`, `dated`, `checkUserStatus`, `m
(1101, '@PetterParker', util.VN_CURDATE(), 0, 'Second test message', 0, 'pending');
INSERT INTO `vn`.`mobileAppVersionControl` (`appName`, `version`, `isVersionCritical`)
INSERT INTO `vn`.`mobileAppVersionControl` (`appName`, `version`, `isVersionCritical`,`versionBeta`)
VALUES
('delivery', '9.2', 0),
('warehouse', '8.1', 0);
('delivery', '9.2', 0,'9.7'),
('warehouse', '8.1', 0,'8.3');
INSERT INTO `vn`.`machine` (`plate`, `maker`, `model`, `warehouseFk`, `departmentFk`, `type`, `use`, `productionYear`, `workerFk`, `companyFk`)
VALUES
@ -3699,3 +3699,5 @@ UPDATE vn.sale
INSERT INTO machineWorkerConfig(maxHours)
VALUES(12);
INSERT INTO workerAppTester(workerFk) VALUES(66)