test(salix): refs #5926 #5926 fix test
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2024-07-08 12:16:08 +02:00
parent 3f1c843332
commit 590e0af038
1 changed files with 20 additions and 21 deletions

View File

@ -1,16 +1,5 @@
const axios = require('axios'); const axios = require('axios');
const {Docuware} = require('vn-loopback/server/server').models; const {Docuware} = require('vn-loopback/server/server').models;
describe('Docuware core', () => {
beforeAll(() => {
process.env.NODE_ENV = 'testing';
spyOn(Docuware, 'hasDeviceReady').and.returnValue(true);
});
afterAll(() => {
delete process.env.NODE_ENV;
});
describe('hasDeviceReady()', () => { describe('hasDeviceReady()', () => {
it('should return true', async() => { it('should return true', async() => {
const result = await Docuware.hasDeviceReady({device: 'Tablet 1'}); const result = await Docuware.hasDeviceReady({device: 'Tablet 1'});
@ -31,6 +20,16 @@ describe('Docuware core', () => {
}); });
}); });
describe('Docuware core', () => {
beforeAll(() => {
process.env.NODE_ENV = 'testing';
spyOn(Docuware, 'hasDeviceReady').and.returnValue(true);
});
afterAll(() => {
delete process.env.NODE_ENV;
});
describe('getOptions()', () => { describe('getOptions()', () => {
it('should return url and headers', async() => { it('should return url and headers', async() => {
const result = await Docuware.getOptions(); const result = await Docuware.getOptions();
@ -173,7 +172,7 @@ describe('Docuware core', () => {
expect(result.id).toEqual(1); expect(result.id).toEqual(1);
}); });
fit('should return data with parse', async() => { it('should return data with parse', async() => {
spyOn(Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random())))); spyOn(Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random()))));
spyOn(Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random())))); spyOn(Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random()))));
const data = { const data = {