@adobe/acc-js-sdk 1.1.61 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/commands/opsx-apply.md +152 -0
- package/.cursor/commands/opsx-archive.md +157 -0
- package/.cursor/commands/opsx-explore.md +173 -0
- package/.cursor/commands/opsx-propose.md +106 -0
- package/.cursor/skills/openspec-apply-change/SKILL.md +156 -0
- package/.cursor/skills/openspec-archive-change/SKILL.md +114 -0
- package/.cursor/skills/openspec-explore/SKILL.md +288 -0
- package/.cursor/skills/openspec-propose/SKILL.md +110 -0
- package/.eslintrc.js +2 -2
- package/.github/prompts/opsx-apply.prompt.md +149 -0
- package/.github/prompts/opsx-archive.prompt.md +154 -0
- package/.github/prompts/opsx-explore.prompt.md +170 -0
- package/.github/prompts/opsx-propose.prompt.md +103 -0
- package/.github/skills/openspec-apply-change/SKILL.md +156 -0
- package/.github/skills/openspec-archive-change/SKILL.md +114 -0
- package/.github/skills/openspec-explore/SKILL.md +288 -0
- package/.github/skills/openspec-propose/SKILL.md +110 -0
- package/.github/workflows/codeql-analysis.yml +5 -4
- package/.github/workflows/npm-publish.yml +3 -3
- package/AGENTS.md +117 -0
- package/CLAUDE.md +2 -0
- package/MIGRATION.md +10 -0
- package/README.md +6 -2
- package/ai-docs/coding-rules.md +95 -0
- package/ai-docs/tech-stack.md +43 -0
- package/babel.config.js +5 -0
- package/docs/changeLog.html +34 -0
- package/docs/checkList.html +2 -2
- package/docs/connectionParameters.html +5 -0
- package/docs/quickstart.html +2 -1
- package/docs/release.html +1 -1
- package/openspec/config.yaml +20 -0
- package/package-lock.json +7437 -3924
- package/package.json +9 -7
- package/src/AGENTS.md +98 -0
- package/src/CLAUDE.md +2 -0
- package/src/application.js +637 -637
- package/src/cache.js +133 -133
- package/src/cacheRefresher.js +190 -190
- package/src/campaign.js +532 -532
- package/src/client.js +1539 -1532
- package/src/crypto.js +52 -52
- package/src/domUtil.js +346 -346
- package/src/entityAccessor.js +61 -61
- package/src/index.js +83 -83
- package/src/methodCache.js +69 -69
- package/src/optionCache.js +26 -26
- package/src/soap.js +321 -322
- package/src/testUtil.js +13 -13
- package/src/transport.js +70 -70
- package/src/util.js +147 -147
- package/src/web/bundler.js +5 -5
- package/src/xtkCaster.js +258 -258
- package/src/xtkEntityCache.js +34 -34
- package/src/xtkJob.js +185 -185
- package/test/AGENTS.md +37 -0
- package/test/CLAUDE.md +2 -0
- package/test/cacheRefresher.test.js +7 -0
- package/test/client.test.js +123 -81
- package/test/jest.config.js +6 -0
- package/test/observability.test.js +6 -1
- package/test/xtkJob.test.js +2 -2
package/test/CLAUDE.md
ADDED
|
@@ -311,6 +311,7 @@ describe("CacheRefresher cache", function () {
|
|
|
311
311
|
});
|
|
312
312
|
|
|
313
313
|
it('Catch error in soap call GetModifiedEntities and display a warning', async () => {
|
|
314
|
+
const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
|
|
314
315
|
const client = await Mock.makeClient();
|
|
315
316
|
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
|
|
316
317
|
|
|
@@ -331,6 +332,12 @@ describe("CacheRefresher cache", function () {
|
|
|
331
332
|
fail('exception is not expected');
|
|
332
333
|
}
|
|
333
334
|
|
|
335
|
+
expect(warnSpy).toHaveBeenCalledWith(
|
|
336
|
+
expect.stringContaining('Failed to refresh cache'),
|
|
337
|
+
expect.anything()
|
|
338
|
+
);
|
|
339
|
+
warnSpy.mockRestore();
|
|
340
|
+
|
|
334
341
|
cacheRefresher.stopAutoRefresh();
|
|
335
342
|
client._transport.mockReturnValueOnce(Mock.LOGOFF_RESPONSE);
|
|
336
343
|
await client.NLWS.xtkSession.logoff();
|
package/test/client.test.js
CHANGED
|
@@ -150,7 +150,7 @@ describe('ACC Client', function () {
|
|
|
150
150
|
|
|
151
151
|
it('Should logon with dummy cookie', async () => {
|
|
152
152
|
/* eslint no-global-assign: "off" */
|
|
153
|
-
document = {};
|
|
153
|
+
global.document = {};
|
|
154
154
|
const client = await Mock.makeClient();
|
|
155
155
|
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
|
|
156
156
|
await client.NLWS.xtkSession.logon();
|
|
@@ -160,7 +160,7 @@ describe('ACC Client', function () {
|
|
|
160
160
|
client._transport.mockReturnValueOnce(Mock.LOGOFF_RESPONSE);
|
|
161
161
|
await client.NLWS.xtkSession.logoff();
|
|
162
162
|
expect(client.isLogged()).toBe(false);
|
|
163
|
-
document = undefined;
|
|
163
|
+
global.document = undefined;
|
|
164
164
|
});
|
|
165
165
|
|
|
166
166
|
it('Should fail if Logon does not return an UserInfo struture', async () => {
|
|
@@ -2335,7 +2335,6 @@ describe('ACC Client', function () {
|
|
|
2335
2335
|
const connectionParameters = sdk.ConnectionParameters.ofBearerToken("http://acc-sdk:8080",
|
|
2336
2336
|
"$token$", {refreshClient: refreshClient});
|
|
2337
2337
|
const client = await sdk.init(connectionParameters);
|
|
2338
|
-
client.traceAPICalls(true);
|
|
2339
2338
|
client._transport = jest.fn();
|
|
2340
2339
|
client._transport.mockReturnValueOnce(Mock.BEARER_LOGON_RESPONSE);
|
|
2341
2340
|
client._transport.mockReturnValueOnce(Promise.resolve(`XSV-350008 Session has expired or is invalid. Please reconnect.`));
|
|
@@ -2349,35 +2348,38 @@ describe('ACC Client', function () {
|
|
|
2349
2348
|
</pdomOutput></ExecuteQueryResponse>
|
|
2350
2349
|
</SOAP-ENV:Body>
|
|
2351
2350
|
</SOAP-ENV:Envelope>`));
|
|
2352
|
-
await
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
"
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
<
|
|
2373
|
-
<
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2351
|
+
await Mock.withMockConsole(async () => {
|
|
2352
|
+
client.traceAPICalls(true);
|
|
2353
|
+
await client.logon();
|
|
2354
|
+
var queryDef = {
|
|
2355
|
+
"schema": "nms:extAccount",
|
|
2356
|
+
"operation": "select",
|
|
2357
|
+
"select": {
|
|
2358
|
+
"node": [
|
|
2359
|
+
{ "expr": "@id" },
|
|
2360
|
+
{ "expr": "@name" }
|
|
2361
|
+
]
|
|
2362
|
+
}
|
|
2363
|
+
};
|
|
2364
|
+
var query = client.NLWS.xtkQueryDef.create(queryDef);
|
|
2365
|
+
var extAccount = await query.executeQuery();
|
|
2366
|
+
expect(extAccount).toEqual({ extAccount: [] });
|
|
2367
|
+
// Same test as before traceAPICalls = false for code coverage
|
|
2368
|
+
client._transport.mockReturnValueOnce(Promise.resolve(`XSV-350008 Session has expired or is invalid. Please reconnect.`));
|
|
2369
|
+
client._transport.mockReturnValueOnce(Promise.resolve(`<?xml version='1.0'?>
|
|
2370
|
+
<SOAP-ENV:Envelope xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:ns='urn:xtk:queryDef' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'>
|
|
2371
|
+
<SOAP-ENV:Body>
|
|
2372
|
+
<ExecuteQueryResponse xmlns='urn:xtk:queryDef' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
|
|
2373
|
+
<pdomOutput xsi:type='ns:Element' SOAP-ENV:encodingStyle='http://xml.apache.org/xml-soap/literalxml'>
|
|
2374
|
+
<extAccount-collection/>
|
|
2375
|
+
</pdomOutput></ExecuteQueryResponse>
|
|
2376
|
+
</SOAP-ENV:Body>
|
|
2377
|
+
</SOAP-ENV:Envelope>`));
|
|
2378
|
+
client.traceAPICalls(false);
|
|
2379
|
+
var query1 = client.NLWS.xtkQueryDef.create(queryDef);
|
|
2380
|
+
const extAccount1 = await query1.executeQuery();
|
|
2381
|
+
expect(extAccount1).toEqual({ extAccount: [] });
|
|
2382
|
+
});
|
|
2381
2383
|
});
|
|
2382
2384
|
|
|
2383
2385
|
it("Expired session refresh client callback for code coverage", async () => {
|
|
@@ -2392,7 +2394,6 @@ describe('ACC Client', function () {
|
|
|
2392
2394
|
const connectionParameters = sdk.ConnectionParameters.ofBearerToken("http://acc-sdk:8080",
|
|
2393
2395
|
"$token$", {refreshClient: refreshClient});
|
|
2394
2396
|
const client = await sdk.init(connectionParameters);
|
|
2395
|
-
client.traceAPICalls(true);
|
|
2396
2397
|
client._transport = jest.fn();
|
|
2397
2398
|
client._transport.mockReturnValueOnce(Mock.BEARER_LOGON_RESPONSE);
|
|
2398
2399
|
client._transport.mockReturnValueOnce(Promise.resolve(`XSV-350008 Session has expired or is invalid. Please reconnect.`));
|
|
@@ -2406,20 +2407,23 @@ describe('ACC Client', function () {
|
|
|
2406
2407
|
</pdomOutput></ExecuteQueryResponse>
|
|
2407
2408
|
</SOAP-ENV:Body>
|
|
2408
2409
|
</SOAP-ENV:Envelope>`));
|
|
2409
|
-
await
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
"
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2410
|
+
await Mock.withMockConsole(async () => {
|
|
2411
|
+
client.traceAPICalls(true);
|
|
2412
|
+
await client.logon();
|
|
2413
|
+
var queryDef = {
|
|
2414
|
+
"schema": "nms:extAccount",
|
|
2415
|
+
"operation": "select",
|
|
2416
|
+
"select": {
|
|
2417
|
+
"node": [
|
|
2418
|
+
{ "expr": "@id" },
|
|
2419
|
+
{ "expr": "@name" }
|
|
2420
|
+
]
|
|
2421
|
+
}
|
|
2422
|
+
};
|
|
2423
|
+
var query = client.NLWS.xtkQueryDef.create(queryDef);
|
|
2424
|
+
var extAccount = await query.executeQuery();
|
|
2425
|
+
expect(extAccount).toEqual({ extAccount: [] });
|
|
2426
|
+
});
|
|
2423
2427
|
});
|
|
2424
2428
|
|
|
2425
2429
|
it("Expired session refresh client callback retry failure", async () => {
|
|
@@ -2777,7 +2781,7 @@ describe('ACC Client', function () {
|
|
|
2777
2781
|
it("Should support storage key type without version information", async () => {
|
|
2778
2782
|
// Default has version & instance name
|
|
2779
2783
|
const version = sdk.getSDKVersion().version; // "${version}" or similar
|
|
2780
|
-
connectionParameters = sdk.ConnectionParameters.ofUserAndPassword("http://acc-sdk:8080", "admin", "admin");
|
|
2784
|
+
let connectionParameters = sdk.ConnectionParameters.ofUserAndPassword("http://acc-sdk:8080", "admin", "admin");
|
|
2781
2785
|
var client = await sdk.init(connectionParameters);
|
|
2782
2786
|
expect(client._optionCache._storage._rootKey).toBe(`acc.js.sdk.${version}.acc-sdk:8080.cache.OptionCache$`);
|
|
2783
2787
|
|
|
@@ -2795,7 +2799,7 @@ describe('ACC Client', function () {
|
|
|
2795
2799
|
it("Should support instanceKey", async () => {
|
|
2796
2800
|
// Default has version & instance name
|
|
2797
2801
|
const version = sdk.getSDKVersion().version; // "${version}" or similar
|
|
2798
|
-
connectionParameters = sdk.ConnectionParameters.ofUserAndPassword("http://acc-sdk:8080", "admin", "admin");
|
|
2802
|
+
let connectionParameters = sdk.ConnectionParameters.ofUserAndPassword("http://acc-sdk:8080", "admin", "admin");
|
|
2799
2803
|
connectionParameters = sdk.ConnectionParameters.ofUserAndPassword("http://acc-sdk:8080", "admin", "admin", { instanceKey: "hello" });
|
|
2800
2804
|
var client = await sdk.init(connectionParameters);
|
|
2801
2805
|
expect(client._optionCache._storage._rootKey).toBe(`acc.js.sdk.${version}.hello.cache.OptionCache$`);
|
|
@@ -2942,7 +2946,6 @@ describe('ACC Client', function () {
|
|
|
2942
2946
|
jest.advanceTimersByTime(18000);
|
|
2943
2947
|
expect(client._entityCacheRefresher._safeCallAndRefresh.mock.calls.length).toBe(1);
|
|
2944
2948
|
expect(client._optionCacheRefresher._safeCallAndRefresh.mock.calls.length).toBe(1);
|
|
2945
|
-
client.traceAPICalls(true);
|
|
2946
2949
|
client._transport = jest.fn();
|
|
2947
2950
|
client._transport.mockReturnValueOnce(Mock.BEARER_LOGON_RESPONSE);
|
|
2948
2951
|
client._transport.mockReturnValueOnce(Promise.resolve(`XSV-350008 Session has expired or is invalid. Please reconnect.`));
|
|
@@ -2956,20 +2959,23 @@ describe('ACC Client', function () {
|
|
|
2956
2959
|
</pdomOutput></ExecuteQueryResponse>
|
|
2957
2960
|
</SOAP-ENV:Body>
|
|
2958
2961
|
</SOAP-ENV:Envelope>`));
|
|
2959
|
-
await
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
"
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2962
|
+
await Mock.withMockConsole(async () => {
|
|
2963
|
+
client.traceAPICalls(true);
|
|
2964
|
+
await client.logon();
|
|
2965
|
+
var queryDef = {
|
|
2966
|
+
"schema": "nms:extAccount",
|
|
2967
|
+
"operation": "select",
|
|
2968
|
+
"select": {
|
|
2969
|
+
"node": [
|
|
2970
|
+
{ "expr": "@id" },
|
|
2971
|
+
{ "expr": "@name" }
|
|
2972
|
+
]
|
|
2973
|
+
}
|
|
2974
|
+
};
|
|
2975
|
+
var query = client.NLWS.xtkQueryDef.create(queryDef);
|
|
2976
|
+
var extAccount = await query.executeQuery();
|
|
2977
|
+
expect(extAccount).toEqual({ extAccount: [] });
|
|
2978
|
+
});
|
|
2973
2979
|
jest.advanceTimersByTime(10000);
|
|
2974
2980
|
expect(client._entityCacheRefresher._safeCallAndRefresh.mock.calls.length).toBe(2);
|
|
2975
2981
|
expect(client._optionCacheRefresher._safeCallAndRefresh.mock.calls.length).toBe(2);
|
|
@@ -3294,7 +3300,6 @@ describe('ACC Client', function () {
|
|
|
3294
3300
|
}
|
|
3295
3301
|
});
|
|
3296
3302
|
await query.executeQuery();
|
|
3297
|
-
console.log(headers);
|
|
3298
3303
|
expect(headers).toMatchObject({
|
|
3299
3304
|
"SoapAction": "xtk:queryDef#ExecuteQuery",
|
|
3300
3305
|
"X-Test": "world",
|
|
@@ -3447,8 +3452,8 @@ describe('ACC Client', function () {
|
|
|
3447
3452
|
});
|
|
3448
3453
|
});
|
|
3449
3454
|
|
|
3450
|
-
it("Should add x-request-id header to
|
|
3451
|
-
const client = await Mock.makeClient();
|
|
3455
|
+
it("Should add x-request-id header to SOAP call when enableRequestIdHeader is true", async () => {
|
|
3456
|
+
const client = await Mock.makeClient({ enableRequestIdHeader: true });
|
|
3452
3457
|
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
|
|
3453
3458
|
await client.NLWS.xtkSession.logon();
|
|
3454
3459
|
|
|
@@ -3480,7 +3485,38 @@ describe('ACC Client', function () {
|
|
|
3480
3485
|
});
|
|
3481
3486
|
|
|
3482
3487
|
it("Should call SOAP call on request ID generation failure", async () => {
|
|
3483
|
-
const client = await Mock.makeClient();
|
|
3488
|
+
const client = await Mock.makeClient({enableRequestIdHeader: true});
|
|
3489
|
+
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
|
|
3490
|
+
await client.NLWS.xtkSession.logon();
|
|
3491
|
+
|
|
3492
|
+
const mockGetUUID = jest.spyOn(Util, 'getUUID').mockImplementation(() => { throw new Error('UUID error'); });
|
|
3493
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
3494
|
+
|
|
3495
|
+
client._transport.mockReturnValueOnce(Mock.GET_XTK_QUERY_SCHEMA_RESPONSE);
|
|
3496
|
+
client._transport.mockReturnValueOnce(Mock.GET_QUERY_EXECUTE_RESPONSE);
|
|
3497
|
+
const queryDef = {
|
|
3498
|
+
"schema": "nms:extAccount",
|
|
3499
|
+
"operation": "select",
|
|
3500
|
+
"select": {
|
|
3501
|
+
"node": [{ "expr": "@id" }]
|
|
3502
|
+
}
|
|
3503
|
+
};
|
|
3504
|
+
|
|
3505
|
+
const query = client.NLWS.xtkQueryDef.create(queryDef);
|
|
3506
|
+
|
|
3507
|
+
const headers = await collectHeaders(client, async() => {
|
|
3508
|
+
await query.executeQuery();
|
|
3509
|
+
});
|
|
3510
|
+
|
|
3511
|
+
expect(headers["x-request-id"]).toBeUndefined();
|
|
3512
|
+
|
|
3513
|
+
mockGetUUID.mockRestore();
|
|
3514
|
+
consoleErrorSpy.mockRestore();
|
|
3515
|
+
});
|
|
3516
|
+
|
|
3517
|
+
|
|
3518
|
+
it("Should not add x-request-id header to SOAP call when enableRequestIdHeader is false", async () => {
|
|
3519
|
+
const client = await Mock.makeClient({ enableRequestIdHeader: false });
|
|
3484
3520
|
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
|
|
3485
3521
|
await client.NLWS.xtkSession.logon();
|
|
3486
3522
|
|
|
@@ -3684,7 +3720,9 @@ describe('ACC Client', function () {
|
|
|
3684
3720
|
describe('upload', () => {
|
|
3685
3721
|
describe("File uploader - on server", () => {
|
|
3686
3722
|
it("is not supported", async () => {
|
|
3723
|
+
const warnSpy = jest.spyOn(console, 'warn').mockImplementation();
|
|
3687
3724
|
const client = await Mock.makeClient();
|
|
3725
|
+
client.traceAPICalls(true);
|
|
3688
3726
|
expect(client.fileUploader).toBeDefined();
|
|
3689
3727
|
await expect(
|
|
3690
3728
|
client.fileUploader.upload({ name: "abcd.txt" })
|
|
@@ -3700,6 +3738,8 @@ describe('ACC Client', function () {
|
|
|
3700
3738
|
name: "CampaignException",
|
|
3701
3739
|
statusCode: 500,
|
|
3702
3740
|
});
|
|
3741
|
+
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining("experimental"));
|
|
3742
|
+
warnSpy.mockRestore();
|
|
3703
3743
|
});
|
|
3704
3744
|
}); // "File uploader - on server"
|
|
3705
3745
|
|
|
@@ -4415,7 +4455,7 @@ describe('ACC Client', function () {
|
|
|
4415
4455
|
type: "text/html",
|
|
4416
4456
|
size: 12345,
|
|
4417
4457
|
}, undefined, 'PREFIX');
|
|
4418
|
-
expect(Util.getUUID).toHaveBeenCalledTimes(
|
|
4458
|
+
expect(Util.getUUID).toHaveBeenCalledTimes(1);
|
|
4419
4459
|
});
|
|
4420
4460
|
}); // "File uploader - on browser"
|
|
4421
4461
|
}); // 'upload'
|
|
@@ -4897,15 +4937,18 @@ describe('ACC Client', function () {
|
|
|
4897
4937
|
const client = await Mock.makeClient();
|
|
4898
4938
|
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
|
|
4899
4939
|
await client.NLWS.xtkSession.logon();
|
|
4900
|
-
|
|
4940
|
+
await Mock.withMockConsole(async () => {
|
|
4941
|
+
client.traceAPICalls(true);
|
|
4901
4942
|
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4943
|
+
client._transport.mockRejectedValueOnce(new HttpError(500, "Error rc=-57"));
|
|
4944
|
+
await expect(client.getReportData({
|
|
4945
|
+
reportName: "throughput",
|
|
4946
|
+
context: "selection",
|
|
4947
|
+
selection: "12133",
|
|
4948
|
+
schema: "nms:delivery"
|
|
4949
|
+
})).rejects.toMatchObject({ statusCode:500, message:"500 - Error 16384: SDK-000014 Failed to fetch report throughput. 500 - Error calling method '/report/throughput?_noRender=true&_schema=nms:delivery&_context=selection&_selection=12133&_selectionCount=1': Error rc=-57" });
|
|
4950
|
+
client.traceAPICalls(false);
|
|
4951
|
+
});
|
|
4909
4952
|
|
|
4910
4953
|
client._transport.mockReturnValueOnce(Mock.LOGOFF_RESPONSE);
|
|
4911
4954
|
await client.NLWS.xtkSession.logoff();
|
|
@@ -4977,8 +5020,7 @@ describe('ACC Client', function () {
|
|
|
4977
5020
|
const schema = client.newSchema(xml);
|
|
4978
5021
|
const jobs = schema.root.children["jobs"];
|
|
4979
5022
|
expect(jobs.target).toBe("xtk:job");
|
|
4980
|
-
// node
|
|
4981
|
-
// node 16+ throws "Cannot read properties of null (reading 'getSchema')"
|
|
5023
|
+
// node 20+ throws "Cannot read properties of null (reading 'getSchema')"
|
|
4982
5024
|
await expect(jobs.linkTarget()).rejects.toThrow(/Cannot read (.*getSchema.*of null)|(.*of null.*getSchema)/);
|
|
4983
5025
|
});
|
|
4984
5026
|
});
|
|
@@ -5013,13 +5055,13 @@ describe('ACC Client', function () {
|
|
|
5013
5055
|
|
|
5014
5056
|
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
|
|
5015
5057
|
|
|
5016
|
-
inputParams = [
|
|
5058
|
+
const inputParams = [
|
|
5017
5059
|
{ name: "login", type: "string", value: "admin" },
|
|
5018
5060
|
{ name: "password", type: "string", value: "admin" },
|
|
5019
5061
|
{ name: "parameters", type: "DOMElement", value: { rememberMe: true } },
|
|
5020
5062
|
|
|
5021
5063
|
];
|
|
5022
|
-
outputParams = [
|
|
5064
|
+
const outputParams = [
|
|
5023
5065
|
{ name: "sessionToken", type: "string" },
|
|
5024
5066
|
{ name: "session", type: "DOMElement" },
|
|
5025
5067
|
{ name: "securityToken", type: "string" },
|
package/test/jest.config.js
CHANGED
|
@@ -28,6 +28,12 @@ module.exports = {
|
|
|
28
28
|
'jest-junit'
|
|
29
29
|
],
|
|
30
30
|
testEnvironment: 'node',
|
|
31
|
+
transform: {
|
|
32
|
+
'^.+\\.m?js$': 'babel-jest'
|
|
33
|
+
},
|
|
34
|
+
transformIgnorePatterns: [
|
|
35
|
+
'/node_modules/(?!(@exodus|@asamuzakjp|@bramus|@csstools|css-tree|parse5|tough-cookie|baseline-browser-mapping)/)'
|
|
36
|
+
],
|
|
31
37
|
setupFilesAfterEnv: [/*
|
|
32
38
|
'<rootDir>/test/jest/jest.setup.js',
|
|
33
39
|
// remove any of the lines below if you don't want to use any of the mocks
|
|
@@ -85,6 +85,7 @@ describe('ACC Client Observability', function () {
|
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
it('Should ignore exceptions throws from observer', async () => {
|
|
88
|
+
const infoSpy = jest.spyOn(console, 'info').mockImplementation(() => {});
|
|
88
89
|
const [client, assertion] = await makeObservableClient({}, (event, parentEvent) => {
|
|
89
90
|
throw new Error("Simulated failure in observer");
|
|
90
91
|
});
|
|
@@ -92,6 +93,7 @@ describe('ACC Client Observability', function () {
|
|
|
92
93
|
// logon will send an observability event, but the error will be logged and ignored
|
|
93
94
|
await client.NLWS.xtkSession.logon();
|
|
94
95
|
expect(assertion.hasObserved("SDK//logon")).toBe(true);
|
|
96
|
+
infoSpy.mockRestore();
|
|
95
97
|
});
|
|
96
98
|
|
|
97
99
|
it('Should send internal stats every 5 minutes', async () => {
|
|
@@ -188,8 +190,11 @@ describe('ACC Client Observability', function () {
|
|
|
188
190
|
const start = assertion.getFirstObserved("CACHE_REFRESHER//start");
|
|
189
191
|
expect(start.event).toMatchObject({ eventName:"CACHE_REFRESHER//start", payload:{ cacheSchemaId: "xtk:option", refreshFrequency: 10000 } });
|
|
190
192
|
|
|
191
|
-
//
|
|
193
|
+
// Simulate a failed API call to get modified entities, generating a CACHE_REFRESHER//error event
|
|
194
|
+
client._transport.mockReturnValueOnce(Promise.reject(new Error("Simulated GetModifiedEntities failure")));
|
|
195
|
+
const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
|
|
192
196
|
await client._optionCacheRefresher._safeCallAndRefresh();
|
|
197
|
+
warnSpy.mockRestore();
|
|
193
198
|
expect(assertion.hasObserved("CACHE_REFRESHER//tick")).toBe(true);
|
|
194
199
|
const tick = assertion.getFirstObserved("CACHE_REFRESHER//tick");
|
|
195
200
|
expect(tick.event).toMatchObject({ eventName:"CACHE_REFRESHER//tick", payload:{ cacheSchemaId: "xtk:option" } });
|
package/test/xtkJob.test.js
CHANGED
|
@@ -603,7 +603,7 @@ describe('XRK Jobs', function () {
|
|
|
603
603
|
});
|
|
604
604
|
client._transport.mockReturnValueOnce(Mock.GET_XTK_JOB_SCHEMA_RESPONSE);
|
|
605
605
|
client._transport.mockReturnValueOnce(MOCK_SUBMIT_JOB_RESPONSE("4210/nms:delivery@@B/C1boHl4jx1AEnDTI4nI137QkcFiiIZf4v++eFsPdM="));
|
|
606
|
-
jobId = await job.submit();
|
|
606
|
+
const jobId = await job.submit();
|
|
607
607
|
|
|
608
608
|
// First call to get status returns the status and a no logs
|
|
609
609
|
client._transport.mockReturnValueOnce(MOCK_GETSTATUS1_RESPONSE(2, 0, 0, true));
|
|
@@ -728,7 +728,7 @@ describe('XRK Jobs', function () {
|
|
|
728
728
|
});
|
|
729
729
|
client._transport.mockReturnValueOnce(Mock.GET_XTK_JOB_SCHEMA_RESPONSE);
|
|
730
730
|
client._transport.mockReturnValueOnce(MOCK_SUBMIT_JOB_RESPONSE("4210/nms:delivery@@B/C1boHl4jx1AEnDTI4nI137QkcFiiIZf4v++eFsPdM="));
|
|
731
|
-
jobId = await job.submit();
|
|
731
|
+
const jobId = await job.submit();
|
|
732
732
|
|
|
733
733
|
// First call to get status returns the status and a no logs
|
|
734
734
|
client._transport.mockReturnValueOnce(MOCK_GETSTATUS1_RESPONSE(2, 0, 0, true));
|