Skip to content

Commit 0afdbc8

Browse files
committed
Merge remote-tracking branch 'origin/master' into release/v6.3.0
# Conflicts: # tests/live/serviceDesk/assets.test.ts
2 parents b3128a0 + 87855cb commit 0afdbc8

2 files changed

Lines changed: 24 additions & 32 deletions

File tree

tests/live/serviceDesk/assets.test.ts

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ import { getClient } from '../setup/client';
66
/**
77
* Live suite for the Service Management `assets` API (`getAssetsWorkspaces`, `getInsightWorkspaces`).
88
*
9-
* Two endpoints that once did the same thing under two names — Insight was renamed Assets, and the older path was
10-
* kept for compatibility. It no longer is: on Cloud today `/assets/workspace` answers and `/insight/workspace` is
11-
* gone, so what used to be worth asserting about the pair — that they behave identically — is simply false, and the
12-
* suite pins the deprecation instead.
9+
* Two endpoints for one thing under two names — Insight was renamed Assets, and the older path is kept for
10+
* compatibility. The suite used to assert that the pair behaves identically, which stopped being true when
11+
* `/assets/workspace` began answering on this tenant while `/insight/workspace` did not.
1312
*
14-
* Both are gated behind the same agent licence as the rest of the surface, so an instance without one refuses rather
15-
* than answers, and the suite accepts either.
13+
* That divergence is a licensing fact, not a retirement: the older path refuses with the same 403 as
14+
* `getServiceDesks`, `getCustomerRequests` and `getOrganizations`, all four carrying a byte-identical copy of Jira's
15+
* generic HTML error page. Atlassian has announced no removal, and both operations remain in the specification. So
16+
* each path is pinned on its own terms — answer or typed refusal — rather than against the other.
17+
*
18+
* What the refusal is worth asserting for is the body: an HTML page is the one response on any of the three surfaces
19+
* that the JSON parser has no way to read, and it still has to arrive as a typed error with its status intact.
1620
*/
1721
describe('Jira Service Management — assets (live)', () => {
1822
let serviceDesk: ServiceDeskClient;
@@ -21,11 +25,18 @@ describe('Jira Service Management — assets (live)', () => {
2125
serviceDesk = createServiceDeskClient(getClient());
2226
});
2327

24-
it('answers the assets workspace lookup, or refuses typed', async () => {
25-
const result = await serviceDesk.assets.getAssetsWorkspaces({ limit: 5 }).catch((e: unknown) => e);
28+
/** Both names answer with the same page of workspace ids, so both are read the same way. */
29+
const lookups: [string, () => Promise<unknown>][] = [
30+
['assets.getAssetsWorkspaces', () => serviceDesk.assets.getAssetsWorkspaces({ limit: 5 })],
31+
['assets.getInsightWorkspaces', () => serviceDesk.assets.getInsightWorkspaces({ limit: 5 })],
32+
];
33+
34+
it.each(lookups)('answers the %s lookup, or refuses typed', async (_name, lookup) => {
35+
const result = await lookup().catch((e: unknown) => e);
2636

2737
if (result instanceof Error) {
28-
expect(isForbiddenError(result) || (result as { status?: number }).status === 404).toBe(true);
38+
expect(isForbiddenError(result)).toBe(true);
39+
expect((result as { status?: number }).status).toBe(403);
2940

3041
return;
3142
}
@@ -38,25 +49,4 @@ describe('Jira Service Management — assets (live)', () => {
3849
expect(typeof workspace.workspaceId).toBe('string');
3950
}
4051
});
41-
42-
/**
43-
* The retired path answers `403` with an HTML error page rather than the JSON every other refusal on this surface
44-
* carries. That is the reason this test is worth keeping now that the paths have diverged: it is the only live
45-
* assertion that a non-JSON body still arrives as a typed error with its status intact, instead of failing inside
46-
* the response parser.
47-
*/
48-
it('refuses the retired Insight path with a typed error, whatever the body', async () => {
49-
const result = await serviceDesk.assets.getInsightWorkspaces({ limit: 1 }).catch((e: unknown) => e);
50-
51-
if (!(result instanceof Error)) {
52-
const page = result as Awaited<ReturnType<typeof serviceDesk.assets.getInsightWorkspaces>>;
53-
54-
expect(Array.isArray(page.values)).toBe(true);
55-
56-
return;
57-
}
58-
59-
expect(typeof (result as { status?: number }).status).toBe('number');
60-
expect(isForbiddenError(result) || (result as { status?: number }).status === 404).toBe(true);
61-
});
6252
});

tests/live/serviceDesk/request.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ import { getClient } from '../setup/client';
99
* Every endpoint here is gated behind an agent licence the test account does not hold, so this file asserts the
1010
* shape of the refusal across the whole surface rather than skipping. Two things make that worth doing.
1111
*
12-
* First, the refusal is a 403 with an empty body — the least informative answer in any of the three surfaces — so
13-
* that it arrives *typed* is the only thing standing between a caller and a bare rejection they cannot classify.
12+
* First, the refusal is a 403 carrying Jira's generic HTML error page rather than a service-desk error — the same
13+
* body `getServiceDesks`, `getOrganizations` and `getInsightWorkspaces` refuse with, and the one answer on any of the
14+
* three surfaces that a JSON parser cannot read at all. That it arrives *typed*, with its status intact, is the only
15+
* thing standing between a caller and a bare rejection they cannot classify.
1416
*
1517
* Second, several of these endpoints would be unsafe even with a licence: `createCustomerRequest` opens a real ticket
1618
* a support team would see, `createRequestComment` writes into a customer conversation, and

0 commit comments

Comments
 (0)