Skip to content

Commit 36bbb9b

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 72b1506 commit 36bbb9b

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
@@ -1033,8 +1033,8 @@ describe('errorUtil', () => {
10331033
'{"name":"projects/p/secrets/s","labels":{"env":"prod"},"versions":[1,2]}',
10341034
);
10351035
assert.strictEqual(resolveResponsePayload('raw body'), 'raw body');
1036+
// Empty responses (e.g. google.protobuf.Empty) still have a payload.
10361037
assert.strictEqual(resolveResponsePayload({}), '{}');
1037-
assert.strictEqual(resolveResponsePayload([]), '[]');
10381038
});
10391039

10401040
it('prefers the raw response provided for paginated and long-running calls', () => {
@@ -1054,7 +1054,6 @@ describe('errorUtil', () => {
10541054
it('returns undefined when there is no response', () => {
10551055
assert.strictEqual(resolveResponsePayload(undefined), undefined);
10561056
assert.strictEqual(resolveResponsePayload(null), undefined);
1057-
assert.strictEqual(resolveResponsePayload(null, null), undefined);
10581057
});
10591058

10601059
it('serializes protobuf messages through their JSON representation', () => {
@@ -1068,15 +1067,6 @@ describe('errorUtil', () => {
10681067
);
10691068
});
10701069

1071-
it('handles circular references and BigInt values without throwing', () => {
1072-
const response: Record<string, unknown> = {size: 10n};
1073-
response.self = response;
1074-
assert.strictEqual(
1075-
resolveResponsePayload(response),
1076-
'{"size":"10","self":"[Circular]"}',
1077-
);
1078-
});
1079-
10801070
it('encodes binary payloads as base64', () => {
10811071
assert.strictEqual(
10821072
resolveResponsePayload(Buffer.from('hello')),

0 commit comments

Comments
 (0)