Skip to content

Commit 3f97aa6

Browse files
committed
add test
1 parent 033b56d commit 3f97aa6

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

apps/sim/tools/utils.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,25 @@ describe('transformTable', () => {
9191
enabled: false,
9292
})
9393
})
94+
95+
it.concurrent('should parse JSON string inputs and transform rows', () => {
96+
const table = [
97+
{ id: '1', cells: { Key: 'city', Value: 'SF' } },
98+
{ id: '2', cells: { Key: 'temp', Value: 64 } },
99+
]
100+
const result = transformTable(JSON.stringify(table))
101+
102+
expect(result).toEqual({
103+
city: 'SF',
104+
temp: 64,
105+
})
106+
})
107+
108+
it.concurrent('should parse JSON string object inputs', () => {
109+
const result = transformTable(JSON.stringify({ a: 1, b: 'two' }))
110+
111+
expect(result).toEqual({ a: 1, b: 'two' })
112+
})
94113
})
95114

96115
describe('formatRequestParams', () => {

0 commit comments

Comments
 (0)