Some checks are pending
CI / build (push) Waiting to run
- Switch package manager from npm to Bun (bun.lock replaces package-lock.json) - Move source to src/main.ts, tests to test/ (flattened structure) - Build output now goes to dist/ with git-based version stamping in manifest - Replace ESLint legacy config with ESLint v9 flat config (typescript-eslint v8) - Add Prettier for formatting (.prettierrc) - Add Husky pre-commit hook running bun run lint - Add vault management scripts (install, uninstall, symlink, unlink) - Add GitHub Actions CI and release workflows - Update tsconfig for TypeScript v5, add isolatedModules/esModuleInterop - Upgrade Jest config to jsdom environment, coverage from src/** - Remove Makefile, version-bump.mjs, versions.json (replaced by bun scripts and git-tag versioning)
192 lines
3.6 KiB
TypeScript
192 lines
3.6 KiB
TypeScript
// Test scenarios and expected results
|
|
|
|
export interface TestScenario {
|
|
name: string;
|
|
content: string;
|
|
expected: {
|
|
totalTasks: number;
|
|
completedTasks: number;
|
|
pendingTasks: number;
|
|
hasPendingTasks: boolean;
|
|
};
|
|
}
|
|
|
|
export const TASK_DETECTION_SCENARIOS: TestScenario[] = [
|
|
{
|
|
name: 'Standard markdown checkboxes',
|
|
content: `
|
|
# My Tasks
|
|
- [ ] Task 1
|
|
- [x] Task 2
|
|
- [ ] Task 3
|
|
`,
|
|
expected: {
|
|
totalTasks: 3,
|
|
completedTasks: 1,
|
|
pendingTasks: 2,
|
|
hasPendingTasks: true,
|
|
},
|
|
},
|
|
{
|
|
name: 'Uppercase X completion',
|
|
content: `
|
|
- [X] Task 1
|
|
- [x] Task 2
|
|
- [ ] Task 3
|
|
`,
|
|
expected: {
|
|
totalTasks: 3,
|
|
completedTasks: 2,
|
|
pendingTasks: 1,
|
|
hasPendingTasks: true,
|
|
},
|
|
},
|
|
{
|
|
name: 'Different bullet types',
|
|
content: `
|
|
- [ ] Dash task 1
|
|
* [ ] Asterisk task 1
|
|
+ [ ] Plus task 1
|
|
- [x] Dash completed
|
|
* [X] Asterisk completed
|
|
+ [x] Plus completed
|
|
`,
|
|
expected: {
|
|
totalTasks: 6,
|
|
completedTasks: 3,
|
|
pendingTasks: 3,
|
|
hasPendingTasks: true,
|
|
},
|
|
},
|
|
{
|
|
name: 'Nested/indented tasks',
|
|
content: `
|
|
- [ ] Main task
|
|
- [ ] Subtask 1
|
|
- [x] Subtask 2
|
|
- [ ] Sub-subtask
|
|
`,
|
|
expected: {
|
|
totalTasks: 4,
|
|
completedTasks: 1,
|
|
pendingTasks: 3,
|
|
hasPendingTasks: true,
|
|
},
|
|
},
|
|
{
|
|
name: 'All tasks completed',
|
|
content: `
|
|
- [x] Task 1
|
|
- [X] Task 2
|
|
- [x] Task 3
|
|
`,
|
|
expected: {
|
|
totalTasks: 3,
|
|
completedTasks: 3,
|
|
pendingTasks: 0,
|
|
hasPendingTasks: false,
|
|
},
|
|
},
|
|
{
|
|
name: 'No tasks',
|
|
content: `
|
|
# Regular Note
|
|
This is just regular content.
|
|
- Regular bullet point
|
|
- Another bullet point
|
|
`,
|
|
expected: {
|
|
totalTasks: 0,
|
|
completedTasks: 0,
|
|
pendingTasks: 0,
|
|
hasPendingTasks: false,
|
|
},
|
|
},
|
|
{
|
|
name: 'Malformed checkboxes ignored',
|
|
content: `
|
|
- [ ] Valid task
|
|
- [] Invalid task (no space)
|
|
- [x] Valid completed
|
|
- [o] Invalid checkbox character
|
|
- [ Invalid bracket
|
|
`,
|
|
expected: {
|
|
totalTasks: 2,
|
|
completedTasks: 1,
|
|
pendingTasks: 1,
|
|
hasPendingTasks: true,
|
|
},
|
|
},
|
|
{
|
|
name: 'Empty content',
|
|
content: '',
|
|
expected: {
|
|
totalTasks: 0,
|
|
completedTasks: 0,
|
|
pendingTasks: 0,
|
|
hasPendingTasks: false,
|
|
},
|
|
},
|
|
{
|
|
name: 'Whitespace only content',
|
|
content: ' \n\n\t \n ',
|
|
expected: {
|
|
totalTasks: 0,
|
|
completedTasks: 0,
|
|
pendingTasks: 0,
|
|
hasPendingTasks: false,
|
|
},
|
|
},
|
|
];
|
|
|
|
export interface FileTestScenario {
|
|
name: string;
|
|
filePath: string;
|
|
parentPath?: string;
|
|
shouldProcess: boolean;
|
|
settings?: {
|
|
includeFolders?: string[];
|
|
excludeFolders?: string[];
|
|
};
|
|
}
|
|
|
|
export const FILE_PROCESSING_SCENARIOS: FileTestScenario[] = [
|
|
{
|
|
name: 'Markdown file should be processed',
|
|
filePath: 'test.md',
|
|
shouldProcess: true,
|
|
},
|
|
{
|
|
name: 'Non-markdown files should be ignored',
|
|
filePath: 'test.txt',
|
|
shouldProcess: false,
|
|
},
|
|
{
|
|
name: 'File in excluded folder should be ignored',
|
|
filePath: 'Templates/template.md',
|
|
parentPath: 'Templates',
|
|
shouldProcess: false,
|
|
settings: {
|
|
excludeFolders: ['Templates'],
|
|
},
|
|
},
|
|
{
|
|
name: 'File not in included folder should be ignored',
|
|
filePath: 'Random/note.md',
|
|
parentPath: 'Random',
|
|
shouldProcess: false,
|
|
settings: {
|
|
includeFolders: ['Daily Notes', 'Projects'],
|
|
},
|
|
},
|
|
{
|
|
name: 'File in included folder should be processed',
|
|
filePath: 'Daily Notes/2023-01-01.md',
|
|
parentPath: 'Daily Notes',
|
|
shouldProcess: true,
|
|
settings: {
|
|
includeFolders: ['Daily Notes', 'Projects'],
|
|
},
|
|
},
|
|
];
|