mirror of https://github.com/msgbyte/tailchat
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
418 B
TypeScript
19 lines
418 B
TypeScript
import { isValidJson } from '../json-helper';
|
|
|
|
describe('isValidJson', () => {
|
|
test.each([
|
|
['foo', false],
|
|
['[]', true],
|
|
['{}', true],
|
|
['{"foo": []}', true],
|
|
['{"foo": [}', false],
|
|
['{foo: bar}', false],
|
|
['{"foo": "bar"}', true],
|
|
[[], false],
|
|
[null, false],
|
|
[undefined, false],
|
|
])('%s => %s', (input: any, should) => {
|
|
expect(isValidJson(input)).toBe(should);
|
|
});
|
|
});
|