feat: add tags workflow

This commit is contained in:
2026-07-16 03:34:23 +05:00
parent 7c0584707a
commit 6eedfb2bc5
29 changed files with 1153 additions and 22 deletions
@@ -93,4 +93,38 @@ title: [unterminated
const issues = validateFrontmatter(content);
expect(issues.some((i) => /yaml/i.test(i.message))).toBe(true);
});
it("does not warn about unknown tags when knownTags is omitted", () => {
const issues = validateFrontmatter(valid);
expect(issues.filter((i) => i.field === "tags")).toEqual([]);
});
it("warns when a tag is not in knownTags", () => {
const content = valid.replace("tags: [bug]", "tags: [bug, nope]");
const issues = validateFrontmatter(content, { knownTags: ["bug"] });
const unknown = issues.filter(
(i) => i.field === "tags" && i.severity === "warning",
);
expect(unknown).toHaveLength(1);
expect(unknown[0].message).toMatch(/nope/i);
});
it("does not warn when all tags are known", () => {
const issues = validateFrontmatter(valid, {
knownTags: ["bug", "frontend"],
});
expect(issues.filter((i) => i.severity === "warning")).toEqual([]);
});
it("warns for every tag when knownTags is empty array (config exists)", () => {
const issues = validateFrontmatter(valid, { knownTags: [] });
expect(
issues.some(
(i) =>
i.field === "tags" &&
i.severity === "warning" &&
/bug/i.test(i.message),
),
).toBe(true);
});
});