Skip to content

Commit

Permalink
Add additional test cases to tag model suite.
Browse files Browse the repository at this point in the history
  • Loading branch information
dannon committed Nov 19, 2024
1 parent cbc49fe commit 8109f78
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions client/src/components/Tags/model.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,35 @@ describe("Tags/model.js", () => {

describe("Tag matching regular expression tests", () => {
it("Should allow valid tags", () => {
const validTags = ["tag1", "tag.subtag", "tag.subtag.subtag", "tag.subtag:value", "🌌", "name:🌌", "🌌.🌌"];
const validTags = [
"tag1",
"tag.subtag",
"tag.subtag.subtag",
"tag.subtag:value",
"🌌",
"name:🌌",
"🌌.🌌",
"name:value..separated",
];
for (const tag of validTags) {
expect(VALID_TAG_RE.test(tag)).toBeTruthy();
}
});
it("Should not allow invalid tags", () => {
const invalidTags = ["", " ", ".", "..", "...", ":", ":value", "tag:", "tag.", ".tag"];
const invalidTags = [
"",
" ",
".",
"..",
"...",
":",
":value",
"tag:",
"tag.",
".tag",
"tag..subtag:value",
"tag:no spaces in value",
];
for (const tag of invalidTags) {
expect(VALID_TAG_RE.test(tag)).toBeFalsy();
}
Expand Down

0 comments on commit 8109f78

Please sign in to comment.