Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: create an test involving quotes #197

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading