markdown-task-checker
Version:
A CLI tool to check markdown task list completion
29 lines (28 loc) • 1.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const parser_1 = require("./parser");
describe("parseMarkdownTasks", () => {
it("should count total and checked tasks correctly", () => {
const md = `
- [x] Done task
- [ ] Not done task
- [x] Another done task
`;
const result = (0, parser_1.parseMarkdownTasks)(md);
expect(result.total).toBe(3);
expect(result.checked).toBe(2);
expect(result.allChecked).toBe(false);
});
it("should return allChecked = true when all are done", () => {
const md = `- [x] All done`;
const result = (0, parser_1.parseMarkdownTasks)(md);
expect(result.allChecked).toBe(true);
});
it("should handle no task lists gracefully", () => {
const md = `# No tasks here`;
const result = (0, parser_1.parseMarkdownTasks)(md);
expect(result.total).toBe(0);
expect(result.checked).toBe(0);
expect(result.allChecked).toBe(false);
});
});