1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-09 05:20:05 +00:00

fix: throw error if null or undefined is passed to getValidJson

This commit is contained in:
2021-09-03 13:54:02 +05:00
parent cf4c4cfca9
commit 779200f5fc
2 changed files with 16 additions and 0 deletions

View File

@@ -33,4 +33,18 @@ describe('jsonValidator', () => {
}
expect(test).toThrow(JsonParseArrayError)
})
it('should throw an error when null is passed', () => {
const test = () => {
getValidJson(null as any)
}
expect(test).toThrow(InvalidJsonError)
})
it('should throw an error when undefined is passed', () => {
const test = () => {
getValidJson(undefined as any)
}
expect(test).toThrow(InvalidJsonError)
})
})