Skip to content

Commit f4107ec

Browse files
committed
test(cli): exercise non-JSON cloud authentication failures
1 parent 9f634f8 commit f4107ec

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎src/cli/__tests__/cloud-response.test.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const options = { invalidJsonMessage: 'Invalid JSON', rejectedMessage: 'Cloud re
88
for (const status of [401, 403]) {
99
test(`cloud response ${status} remains an authentication error`, async () => {
1010
await assert.rejects(
11-
readCloudJsonResponse(new Response('{"token":"secret"}', { status }), options),
11+
readCloudJsonResponse(new Response('private-body-secret', { status }), options),
1212
(error: unknown) => {
1313
const normalized = normalizeError(error);
1414
assert.equal(normalized.code, 'UNAUTHORIZED');
@@ -20,14 +20,14 @@ for (const status of [401, 403]) {
2020
});
2121
}
2222

23-
for (const [status, retriable] of [
24-
[404, undefined],
25-
[429, true],
26-
[503, true],
23+
for (const [status, retriable, body] of [
24+
[404, undefined, '{"error":"private-body-secret"}'],
25+
[429, true, '<html>secret</html>'],
26+
[503, true, '<html>secret</html>'],
2727
] as const) {
2828
test(`cloud response ${status} preserves status without requesting login`, async () => {
2929
await assert.rejects(
30-
readCloudJsonResponse(new Response('<html>secret</html>', { status }), options),
30+
readCloudJsonResponse(new Response(body, { status }), options),
3131
(error: unknown) => {
3232
const normalized = normalizeError(error);
3333
assert.equal(normalized.code, 'COMMAND_FAILED');

0 commit comments

Comments
 (0)