mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-16 00:20:06 +00:00
style: lint
This commit is contained in:
@@ -1,31 +1,31 @@
|
|||||||
import { isValidJson } from "../../utils"
|
import { isValidJson } from '../../utils'
|
||||||
|
|
||||||
describe.only('jsonValidator', () => {
|
describe.only('jsonValidator', () => {
|
||||||
it('should not throw an error with an valid json', () => {
|
it('should not throw an error with an valid json', () => {
|
||||||
const json = {
|
const json = {
|
||||||
test: 'test'
|
test: 'test'
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(isValidJson(json)).not.toThrowError
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should not throw an error with an valid json string', () => {
|
||||||
|
const json = JSON.stringify({
|
||||||
|
test: 'test'
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(isValidJson(json)).not.toThrowError
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should throw an error with an invalid json', () => {
|
||||||
|
const json = `{\"test\":\"test\"\"test2\":\"test\"}`
|
||||||
|
|
||||||
|
expect(() => {
|
||||||
|
try {
|
||||||
|
isValidJson(json)
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error()
|
||||||
}
|
}
|
||||||
|
}).toThrowError
|
||||||
expect(isValidJson(json)).not.toThrowError
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should not throw an error with an valid json string', () => {
|
|
||||||
const json = JSON.stringify({
|
|
||||||
test: 'test'
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(isValidJson(json)).not.toThrowError
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should throw an error with an invalid json', () => {
|
|
||||||
const json = `{\"test\":\"test\"\"test2\":\"test\"}`
|
|
||||||
|
|
||||||
expect(() => {
|
|
||||||
try {
|
|
||||||
isValidJson(json)
|
|
||||||
} catch(err) {
|
|
||||||
throw new Error()
|
|
||||||
}
|
|
||||||
}).toThrowError
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|||||||
Reference in New Issue
Block a user