Skip to content

Commit 68fc8e3

Browse files
committed
test(requestBuilder): update array serialization expectations
Update test expectations to match new array serialization behavior. Arrays are now serialized as JSON strings (e.g., '[1,2,3]') instead of comma-separated values for consistency with object serialization. This aligns with the type-safe serializeValue() implementation that uses JSON.stringify for objects and arrays.
1 parent 6407bf6 commit 68fc8e3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/tests/requestBuilder.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ describe('RequestBuilder', () => {
302302

303303
// Complex object should use deep object serialization
304304
expect(url.searchParams.get('complexObject[nested]')).toBe('nested-value');
305-
expect(url.searchParams.get('complexObject[array]')).toBe('1,2,3'); // Arrays become strings
305+
expect(url.searchParams.get('complexObject[array]')).toBe('[1,2,3]'); // Arrays become JSON strings
306306
expect(url.searchParams.get('complexObject[nestedObject][deep]')).toBe('deep-value');
307307

308308
// Original complex object should not be present
@@ -436,10 +436,10 @@ describe('RequestBuilder', () => {
436436
const result = await builder.execute(params, { dryRun: true });
437437
const url = new URL(result.url as string);
438438

439-
// Arrays should be converted to comma-separated strings
440-
expect(url.searchParams.get('filter[arrayField]')).toBe('1,2,3');
441-
expect(url.searchParams.get('filter[stringArray]')).toBe('a,b,c');
442-
expect(url.searchParams.get('filter[mixed]')).toBe('string,42,true');
439+
// Arrays should be converted to JSON strings
440+
expect(url.searchParams.get('filter[arrayField]')).toBe('[1,2,3]');
441+
expect(url.searchParams.get('filter[stringArray]')).toBe('["a","b","c"]');
442+
expect(url.searchParams.get('filter[mixed]')).toBe('["string",42,true]');
443443
});
444444

445445
it('should handle nested objects with special types', async () => {

0 commit comments

Comments
 (0)