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!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
test(stylesheet): correct the malformed declaration offset
Amruth Pillai817d4ef97125
diff --git a/packages/resume/src/stylesheet/parse.test.ts b/packages/resume/src/stylesheet/parse.test.tsindex 18e935f9a..5e56a52dd 100644--- a/packages/resume/src/stylesheet/parse.test.ts+++ b/packages/resume/src/stylesheet/parse.test.ts@@ -3,12 +3,16 @@ import { parseStylesheet } from "./parse";describe("parseStylesheet", () => {it("returns exact ranges for malformed declarations and keeps a recoverable parse tree", () => {- const result = parseStylesheet("@version 1;\nsection { color red; }\nitem { opacity: .5; }");+ const source = "@version 1;\nsection { color red; }\nitem { opacity: .5; }";+ const result = parseStylesheet(source);expect(result.diagnostics[0]?.range).toEqual({- start: { line: 2, column: 17, offset: 31 },- end: { line: 2, column: 17, offset: 31 },+ start: { line: 2, column: 17, offset: 28 },+ end: { line: 2, column: 17, offset: 28 },});+ // Anchor the offset to the source it must point at, so a parser change that shifts it fails+ // loudly instead of leaving line/column and offset disagreeing.+ expect(source.slice(28, 31)).toBe("red");expect(result.rules).toHaveLength(2);});