mirror of
https://github.com/openharmony/third_party_css-what.git
synced 2026-07-01 03:23:11 -04:00
6645b076bf
Signed-off-by: lixingchi1 <lixingchi1@huawei.com>
23 lines
733 B
TypeScript
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]);
|
|
}
|
|
});
|
|
});
|