Files
directus/packages/utils/shared/is-valid-json.test.ts
Rijk van Zanten c48309ab68 Last eslint tweak (#18198)
* Should be there now

* Format
2023-04-14 17:40:50 -04:00

15 lines
409 B
TypeScript

import { describe, expect, it } from 'vitest';
import { isValidJSON } from './is-valid-json.js';
describe('isValidJSON', () => {
it('returns true if JSON is valid', () => {
const result = isValidJSON(`{"name": "Directus"}`);
expect(result).toEqual(true);
});
it('returns false if JSON is invalid', () => {
const result = isValidJSON(`{"name: Directus"}`);
expect(result).toEqual(false);
});
});