Skip to content

Commit

Permalink
chore: create an test involving quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
a2937 committed Apr 25, 2024
1 parent eacff66 commit 0f8e93f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/__fixtures__/curriculum-helpers-html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ not a comment
not a comment
`;

const commentInQuoteExample = `
The string "<!--".
Optionally, text, with the additional restriction that the text must not start with the string ">", nor start with the string "->", nor contain the strings "<!--", "-->", or "--!>", nor end with the string "<!-".
The string "-->".
`;

const testValues = {
htmlFullExample,
htmlCodeWithCommentsRemoved,
commentInQuoteExample,
};

export default testValues;
9 changes: 8 additions & 1 deletion lib/__tests__/curriculum-helper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const { stringWithWhiteSpaceChars, stringWithWhiteSpaceCharsRemoved } =

const { cssFullExample, cssCodeWithCommentsRemoved } = cssTestValues;

const { htmlFullExample, htmlCodeWithCommentsRemoved } = htmlTestValues;
const { htmlFullExample, htmlCodeWithCommentsRemoved, commentInQuoteExample } =
htmlTestValues;

const {
jsCodeWithSingleAndMultLineComments,
Expand Down Expand Up @@ -87,6 +88,12 @@ describe("removeHtmlComments", () => {
htmlCodeWithCommentsRemoved
);
});

it("returns an HTML string with comments inside quotes intact", function () {
expect(removeHtmlComments(commentInQuoteExample)).toBe(
commentInQuoteExample
);
});
});

describe("isCalledWithNoArgs", () => {
Expand Down

0 comments on commit 0f8e93f

Please sign in to comment.