blob: 2b301b0c9839e4e8355e7aad6fc969bd7a1631c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import { test, describe } from "mocha";
import assert from "assert";
import { convertSingleToDoubleQuoteJSON } from "../util/util";
describe("utils.ts", () => {
test("convertSingleToDoubleQuoteJson", () => {
let pairs = [
[`{'a': 'b'}`, `{"a": "b"}`],
[`{'a': "b", "c": 'd'}`, `{"a": "b", "c": "d"}`],
[`{'a': '\\'"'}`, `{"a": "'\\""}`],
];
for (let pair of pairs) {
let result = convertSingleToDoubleQuoteJSON(pair[0]);
assert(result === pair[1]);
JSON.parse(result);
}
});
});
|