Files
third_party_css-what/src/stringify.spec.ts
T
lixingchi1 6645b076bf update css-what from 2.1.3 to v6.1.0
Signed-off-by: lixingchi1 <lixingchi1@huawei.com>
2022-09-07 15:35:20 +08:00

23 lines
733 B
TypeScript

import { readFileSync } from "fs";
import { parse, stringify } from ".";
import { tests } from "./__fixtures__/tests";
describe("Stringify & re-parse", () => {
describe("Own tests", () => {
for (const [selector, expected, message] of tests) {
test(`${message} (${selector})`, () => {
expect(parse(stringify(expected))).toStrictEqual(expected);
});
}
});
it("Collected Selectors (qwery, sizzle, nwmatcher)", () => {
const out = JSON.parse(
readFileSync(`${__dirname}/__fixtures__/out.json`, "utf8")
);
for (const s of Object.keys(out)) {
expect(parse(stringify(out[s]))).toStrictEqual(out[s]);
}
});
});