Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
Signed-off-by: ryjiang <[email protected]>
  • Loading branch information
shanghaikid committed Nov 6, 2024
1 parent dd5422d commit 6564a8c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/utils/Format.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,10 +557,16 @@ describe('utils/format', () => {
it('should return the JSON stringified value of the field for JSON type', () => {
const row = { name: 'John', data: { age: 25, city: 'New York' } };
const field = { type: 'JSON', name: 'data' };
expect(JSON.parse(buildFieldData(row, field as _Field)!.toString())).toEqual({
expect(
JSON.parse(buildFieldData(row, field as _Field)!.toString())
).toEqual({
age: 25,
city: 'New York',
});

// if json field is not in the row, should return Buffer.alloc(0)
const row2 = { name: 'John' };
expect(buildFieldData(row2, field as _Field)).toEqual(Buffer.alloc(0));
});

it('should recursively call buildFieldData for Array type', () => {
Expand Down

0 comments on commit 6564a8c

Please sign in to comment.