Skip to content

Commit 0570a43

Browse files
committed
test(gax): remove resolveResponsePayload tests duplicated by safeJsonStringify tests
resolveResponsePayload passes non-string, non-binary payloads to safeJsonStringify, whose own tests cover circular references and BigInt values. Also drop assertions that repeat the JSON path ([]) or combine two existing cases ((null, null)).
1 parent 4d87db1 commit 0570a43

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

‎core/packages/gax/test/unit/errorUtil.ts‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,8 +1152,8 @@ describe('errorUtil', () => {
11521152
'{"name":"projects/p/secrets/s","labels":{"env":"prod"},"versions":[1,2]}',
11531153
);
11541154
assert.strictEqual(resolveResponsePayload('raw body'), 'raw body');
1155+
// Empty responses (e.g. google.protobuf.Empty) still have a payload.
11551156
assert.strictEqual(resolveResponsePayload({}), '{}');
1156-
assert.strictEqual(resolveResponsePayload([]), '[]');
11571157
});
11581158

11591159
it('prefers the raw response provided for paginated and long-running calls', () => {
@@ -1173,7 +1173,6 @@ describe('errorUtil', () => {
11731173
it('returns undefined when there is no response', () => {
11741174
assert.strictEqual(resolveResponsePayload(undefined), undefined);
11751175
assert.strictEqual(resolveResponsePayload(null), undefined);
1176-
assert.strictEqual(resolveResponsePayload(null, null), undefined);
11771176
});
11781177

11791178
it('serializes protobuf messages through their JSON representation', () => {
@@ -1187,15 +1186,6 @@ describe('errorUtil', () => {
11871186
);
11881187
});
11891188

1190-
it('handles circular references and BigInt values without throwing', () => {
1191-
const response: Record<string, unknown> = {size: 10n};
1192-
response.self = response;
1193-
assert.strictEqual(
1194-
resolveResponsePayload(response),
1195-
'{"size":"10","self":"[Circular]"}',
1196-
);
1197-
});
1198-
11991189
it('encodes binary payloads as base64', () => {
12001190
assert.strictEqual(
12011191
resolveResponsePayload(Buffer.from('hello')),

0 commit comments

Comments
 (0)