Updated the process for retrieving records from CRMServiceRequests

This commit is contained in:
2026-10-28 11:43:26 -03:00
parent 318459cef8
commit 3fa212e561
17 changed files with 796 additions and 328 deletions

View 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);
});