diff options
author | 2022-03-10 14:39:42 +0000 | |
---|---|---|
committer | 2022-03-14 11:53:36 +0000 | |
commit | 93b5533e44728faa87c291fbf44120ea013fab51 (patch) | |
tree | fa26abbb89f0c596c84371f3c144957b9591167c /gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexAjax.test.js | |
parent | 1e95c73cef25b524bc1f5791d4578332670202f7 (diff) |
Upgrade apex-pdp version in Apex Editor
Upgrade apex-pdp version to 2.7.1-SNAPSHOT
Fix NullPointerException in ModelHandler::setUuidAndDescription
Allow parsing models from policy_type_impl or apexPolicyModel
Remove deprecated Task input and output field functionality
Fix JS REST calls and tests after JAXB to Gson changes
Fix bugs in Task Edit form relating to task logic edit area
Issue-ID: POLICY-3990
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: I4f506889df46619a0178ab99c99c73ec2fd5a1e3
Diffstat (limited to 'gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexAjax.test.js')
-rw-r--r-- | gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexAjax.test.js | 74 |
1 files changed, 52 insertions, 22 deletions
diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexAjax.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexAjax.test.js index 362a1f9..9880328 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexAjax.test.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexAjax.test.js @@ -60,49 +60,79 @@ test('Test ajax_get success', (done) => { test('Test ajax_getWithKeyInfo success', (done) => { const myCallback = jest.fn((actual) => { expect(actual).toEqual({ - key: { - name: "name1", - version: "version1" - }, + key: { name: "name1", version: "version1" }, uuid: "UUID1", description: "description1" }); done(); }); - data.messages = [ - '{"apexKeyInfo": {"UUID": "UUID1", "description": "description1", "key":{"name": "name1", "version":' + - ' "version1"}}, "objectType": {"key": {"name": "name1", "version": "version1"}}}' - ]; const jqXHR = {status: 200, responseText: ""}; $.ajax = jest.fn().mockImplementation((args) => { - args.success(data, null, jqXHR); - }); - mod.ajax_getWithKeyInfo("requestUrl", "objectType", myCallback, undefined); + if (args.url.endsWith("/KeyInformation/Get?name=&version=")) { + var results1 = { + messages: [ + JSON.stringify({ + UUID: "UUID1", + description: "description1", + key: { name: "name1", version: "version1" } + }) + ], + result: 'SUCCESS' + }; + args.success(results1, null, jqXHR); + } else if (args.url === "requestUrl") { + var results2 = { + messages: [ + JSON.stringify({ + key: { name: "name1", version: "version1" } + }) + ], + result: 'SUCCESS' + }; + args.success(results2, null, jqXHR); + } + }); + mod.ajax_getWithKeyInfo("requestUrl", myCallback, undefined); }); test('Test ajax_getWithKeyInfo with custom key success', (done) => { const myCallback = jest.fn((actual) => { expect(actual).toEqual({ - customKey: { - name: "name1", - version: "version1" - }, + customKey: { name: "name1", version: "version1" }, uuid: "UUID1", description: "description1" }); done(); }); - data.messages = [ - '{"apexKeyInfo": {"UUID": "UUID1", "description": "description1", "key":{"name": "name1",' + - ' "version": "version1"}}, "objectType": {"customKey": {"name": "name1", "version": "version1"}}}' - ]; const jqXHR = {status: 200, responseText: ""}; $.ajax = jest.fn().mockImplementation((args) => { - args.success(data, null, jqXHR); - }); - mod.ajax_getWithKeyInfo("requestUrl", "objectType", myCallback, "customKey"); + if (args.url.endsWith("/KeyInformation/Get?name=&version=")) { + var results1 = { + messages: [ + JSON.stringify({ + UUID: "UUID1", + description: "description1", + key: { name: "name1", version: "version1" } + }) + ], + result: 'SUCCESS' + }; + args.success(results1, null, jqXHR); + } else if (args.url === "requestUrl") { + var results2 = { + messages: [ + JSON.stringify({ + customKey: { name: "name1", version: "version1" } + }) + ], + result: 'SUCCESS' + }; + args.success(results2, null, jqXHR); + } + }); + mod.ajax_getWithKeyInfo("requestUrl", myCallback, "customKey"); }); test('Test ajax_delete error', () => { |