diff options
author | Liam Fallon <liam.fallon@est.tech> | 2022-02-04 09:04:16 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2022-02-04 09:04:16 +0000 |
commit | f342bf5bd3684998f66cfd78213303e90abbd90f (patch) | |
tree | 33bc1f9368cb1d62632e194b0966721df146c58c /gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexMain.test.js | |
parent | d211be2cbad3ae4dea9dc90dcac80cccd9a510ab (diff) | |
parent | 02311dcd02872c548418d51eb770a08b3f32e18f (diff) |
Merge "Policy Gui Code Coverage"
Diffstat (limited to 'gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexMain.test.js')
-rw-r--r-- | gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexMain.test.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexMain.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexMain.test.js index d26d926..beb73f5 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexMain.test.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexMain.test.js @@ -18,9 +18,11 @@ */ const mod = require('../ApexMain'); - +const $ = require('jquery'); test('Test main_getRestRootURL', () => { + jest.spyOn(window.localStorage.__proto__, 'getItem'); + window.localStorage.__proto__.getItem = jest.fn(() => true); const mock_main_getRestRootURL = jest.fn(mod.main_getRestRootURL); mock_main_getRestRootURL(); expect(mock_main_getRestRootURL).toBeCalled(); @@ -30,4 +32,13 @@ test('Test clearLocalStorage', () => { const mock_clearLocalStorage = jest.fn(mod.clearLocalStorage); mock_clearLocalStorage(); expect(mock_clearLocalStorage).toBeCalled(); +}); + +test('test ready', () => { + document.documentElement.innerHTML = '<html><head></head><body><ul id="menu li"><li><div>menu</div><ul><li><div>FileNew</div></li></ul></li></ul></body></html>'; + window.$ = $; + $("#menu li").click(); + let h1 = document.querySelector('ul'); + console.log(document.documentElement.innerHTML); + expect(h1.textContent).toEqual('menuFileNew'); });
\ No newline at end of file |