Updated the process for retrieving records from CRMServiceRequests
This commit is contained in:
14
tests/internalSrRecovery.test.cjs
Normal file
14
tests/internalSrRecovery.test.cjs
Normal file
@@ -0,0 +1,14 @@
|
||||
const assert = require('node:assert/strict');
|
||||
const { test } = require('node:test');
|
||||
const fs = require('node:fs');
|
||||
const vm = require('node:vm');
|
||||
const factory = vm.runInNewContext(fs.readFileSync('src/services/fusion/sr-details.js', 'utf8') + '\ncreateFusionSrDetails');
|
||||
test('Internal SR background returns 401 without opening any tab or retrying', async () => {
|
||||
let calls = 0;
|
||||
const api = factory({
|
||||
fetchJson: async () => { calls++; throw Object.assign(new Error('Unauthorized'), {httpStatus:401}); },
|
||||
tabsCreate: () => assert.fail('Internal SR must not open a tab')
|
||||
});
|
||||
await assert.rejects(api.requestInternalServiceRequest({srId:'123'}), /Unauthorized/);
|
||||
assert.equal(calls,1);
|
||||
});
|
||||
Reference in New Issue
Block a user