mirror of
https://github.com/qlik-oss/nebula.js.git
synced 2026-05-25 01:00:13 -04:00
* test: deprecate `aw` and rename all jest unit tests from `.inspect` to `.test` * test: rename jest unit tests and update ci
54 lines
1.8 KiB
JavaScript
54 lines
1.8 KiB
JavaScript
import { getAppLink } from '../appLinkManager';
|
|
|
|
describe('getAppLink()', () => {
|
|
let navigate;
|
|
let location;
|
|
let targetApp;
|
|
let info;
|
|
|
|
beforeEach(() => {
|
|
info = {};
|
|
navigate = jest.fn();
|
|
location = { search: '' };
|
|
targetApp = 'targetAppId';
|
|
});
|
|
|
|
afterEach(() => {
|
|
jest.restoreAllMocks();
|
|
jest.resetAllMocks();
|
|
});
|
|
|
|
test('should call navigate to correct engine url from localhost', () => {
|
|
info = { engineUrl: 'ws://localhost:1234', enigma: { secure: false, host: 'localhost', port: 1234 } };
|
|
location.search = `engine_url=${info.engineUrl}`;
|
|
getAppLink({ navigate, location, info, targetApp });
|
|
|
|
expect(navigate).toHaveBeenCalledTimes(1);
|
|
expect(navigate).toHaveBeenCalledWith(`/dev/engine_url=${info.engineUrl}/app/${targetApp}`);
|
|
});
|
|
|
|
test('should call navigate to correct engine url from remote SDE', () => {
|
|
info = {
|
|
engineUrl: 'wss://some-remote.sde.in.eu.qlikdev.com',
|
|
enigma: { secure: true, host: 'some-remote.sde.in.eu.qlikdev.com' },
|
|
};
|
|
location.search = `engine_url=${info.engineUrl}`;
|
|
getAppLink({ navigate, location, info, targetApp });
|
|
|
|
expect(navigate).toHaveBeenCalledTimes(1);
|
|
expect(navigate).toHaveBeenCalledWith(`/dev/engine_url=${info.engineUrl}/app/${targetApp}`);
|
|
});
|
|
|
|
test('should remove `shouldFetchAppList` if it was in search', () => {
|
|
info = {
|
|
engineUrl: 'wss://some-remote.sde.in.eu.qlikdev.com',
|
|
enigma: { secure: true, host: 'some-remote.sde.in.eu.qlikdev.com' },
|
|
};
|
|
location.search = `engine_url=${info.engineUrl}&shouldFetchAppList=true`;
|
|
getAppLink({ navigate, location, info, targetApp });
|
|
|
|
expect(navigate).toHaveBeenCalledTimes(1);
|
|
expect(navigate).toHaveBeenCalledWith(`/dev/engine_url=${info.engineUrl}/app/${targetApp}`);
|
|
});
|
|
});
|