Implemented the Create Internal Service Request functionality
This commit is contained in:
@@ -3,6 +3,33 @@ const { test } = require("node:test");
|
||||
const { loadBackground, response } = require("./support/characterization.cjs");
|
||||
const type = "opportunitiesExtension.requestInternalServiceRequest";
|
||||
|
||||
test("internal SR form lookups use management proxy, Session and parent SrId", async () => {
|
||||
const calls = [];
|
||||
const h = loadBackground({ fetch: async (url, options) => {
|
||||
calls.push({ url: new URL(url), options });
|
||||
return response({ items: String(url).includes("/lookups?")
|
||||
? [{ code: "OCI", name: "Oracle Cloud" }]
|
||||
: [{ Id: 123, RecordName: "Review", Description_c: "Review the architecture" }] });
|
||||
} });
|
||||
const platform = await h.dispatch({ type: "opportunitiesExtension.requestLookupTypePlatform" });
|
||||
assert.equal(platform.ok, true);
|
||||
assert.equal(platform.items[0].code, "OCI");
|
||||
const service = await h.dispatch({ type: "opportunitiesExtension.requestInternalSrServices", parentServiceId: "456", emailAddress: "user+test@example.invalid" });
|
||||
assert.equal(service.ok, true);
|
||||
assert.equal(service.items[0].Id, "123");
|
||||
assert.equal(service.items[0].Description_c, "Review the architecture");
|
||||
assert.equal(calls[1].url.searchParams.get("parentServiceId"), "456");
|
||||
assert.equal(calls[1].url.searchParams.get("emailAddress"), "user+test@example.invalid");
|
||||
assert.equal(calls[1].url.searchParams.get("serviceType"), "INTERNAL");
|
||||
for (const call of calls) {
|
||||
assert.match(call.url.pathname, /SeaaS_SR_management.*oalsetSeaaSOKECustomRestAPI/);
|
||||
assert.equal(call.options.headers.Authorization, "Session");
|
||||
assert.equal(call.options.credentials, "include");
|
||||
}
|
||||
assert.equal((await h.dispatch({ type: "opportunitiesExtension.requestInternalSrServices", parentServiceId: "bad", emailAddress: "user@example.invalid" })).ok, false);
|
||||
assert.equal(calls.length, 2);
|
||||
});
|
||||
|
||||
test("preparation reuses an existing unexpired cookie pair without navigation or API calls", async () => {
|
||||
const domain = "comcipapic-oalprod.integration.ocp.oraclecloud.com";
|
||||
const h = loadBackground({
|
||||
|
||||
Reference in New Issue
Block a user