Skip to content

Commit 691691e

Browse files
authored
Merge pull request #132 from andrewvasilchuk/patch-2
test: add tests for float and JSON casting
2 parents 7fc6089 + 320eb8c commit 691691e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

__tests__/index.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,4 +609,13 @@ describe('cast', () => {
609609
test('casts int to number', () => {
610610
expect(cast({ name: 'test', type: 'INT8' }, '12')).toEqual(12)
611611
})
612+
613+
test('casts float to number', () => {
614+
expect(cast({ name: 'test', type: 'FLOAT32' }, '2.32')).toEqual(2.32)
615+
expect(cast({ name: 'test', type: 'FLOAT64' }, '2.32')).toEqual(2.32)
616+
})
617+
618+
test('casts JSON string to JSON object', () => {
619+
expect(cast({ name: 'test', type: 'JSON' }, '{ "foo": "bar" }')).toStrictEqual({ foo: 'bar' })
620+
})
612621
})

0 commit comments

Comments
 (0)