Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

702 B
Raw Blame
import { describe, expect, it } from "vite-plus/test";
import { escapeCssComment, escapeCssString, serializeGeneratedStylesheet } from "./serialize";

describe("generated Semantic CSS serialization", () => {
	it("escapes labels and strings without creating CSS delimiters", () => {
		expect(escapeCssComment("*/ next")).toBe("*\\/ next");
		expect(escapeCssString('"\\\n')).toBe('"\\"\\\\\\a "');
	});

	it("rejects generated declarations that could escape their block", () => {
		expect(() =>
			serializeGeneratedStylesheet({
				languageVersion: 1,
				blocks: [{ selector: "field", declarations: { color: "red; page { color: blue" } }],
			}),
		).toThrow("unsafe CSS declaration value");
	});
});