1import { readFileSync } from "fs"; 2import { parse, stringify } from "."; 3import { tests } from "./__fixtures__/tests"; 4 5describe("Stringify & re-parse", () => { 6 describe("Own tests", () => { 7 for (const [selector, expected, message] of tests) { 8 test(`${message} (${selector})`, () => { 9 expect(parse(stringify(expected))).toStrictEqual(expected); 10 }); 11 } 12 }); 13 14 it("Collected Selectors (qwery, sizzle, nwmatcher)", () => { 15 const out = JSON.parse( 16 readFileSync(`${__dirname}/__fixtures__/out.json`, "utf8") 17 ); 18 for (const s of Object.keys(out)) { 19 expect(parse(stringify(out[s]))).toStrictEqual(out[s]); 20 } 21 }); 22}); 23