Skip to content

Commit 64ee9bf

Browse files
committed
feat: update for test
2 parents 8d47d46 + a8df0ff commit 64ee9bf

11 files changed

Lines changed: 922 additions & 575 deletions

src/__tests__/ArchiveActionExecutor.canvas.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ describe("ArchiveActionExecutor - Canvas Tasks", () => {
127127
const modifyCall = mockVault.modify.mock.calls[0];
128128
const modifiedContent = modifyCall[1];
129129
expect(modifiedContent).toContain(
130-
"- [x] Test Canvas task #project/test - Completed"
130+
"- [x] Test Canvas task #project/test ✅ 2025-07-04"
131131
);
132132
expect(modifiedContent).toMatch(/\d{4}-\d{2}-\d{2}/); // Date pattern
133133
});
@@ -189,7 +189,7 @@ describe("ArchiveActionExecutor - Canvas Tasks", () => {
189189
const modifiedContent = modifyCall[1];
190190
expect(modifiedContent).toContain("## High Priority Tasks");
191191
expect(modifiedContent).toContain(
192-
"- [x] Important Canvas task ⏫ - Completed"
192+
"- [x] Important Canvas task ⏫ ✅ 2025-07-04"
193193
);
194194
});
195195

@@ -440,7 +440,7 @@ describe("ArchiveActionExecutor - Canvas Tasks", () => {
440440
const modifiedContent = modifyCall[1];
441441
expect(modifiedContent).toContain("## New Section");
442442
expect(modifiedContent).toContain(
443-
"- [x] Test Canvas task - Completed"
443+
"- [x] Test Canvas task ✅ 2025-07-04"
444444
);
445445
});
446446
});
@@ -567,7 +567,7 @@ describe("ArchiveActionExecutor - Canvas Tasks", () => {
567567
const modifyCall = mockVault.modify.mock.calls[0];
568568
const modifiedContent = modifyCall[1];
569569
expect(modifiedContent).toContain(
570-
"- [x] Task with onCompletion - Completed"
570+
"- [x] Task with onCompletion ✅ 2025-07-04"
571571
);
572572
expect(modifiedContent).not.toContain("🏁");
573573
expect(modifiedContent).not.toContain("archive:done.md");
@@ -625,7 +625,7 @@ describe("ArchiveActionExecutor - Canvas Tasks", () => {
625625
const modifyCall = mockVault.modify.mock.calls[0];
626626
const modifiedContent = modifyCall[1];
627627
expect(modifiedContent).toContain(
628-
"- [x] Task with JSON onCompletion - Completed"
628+
"- [x] Task with JSON onCompletion ✅ 2025-07-04"
629629
);
630630
expect(modifiedContent).not.toContain("🏁");
631631
expect(modifiedContent).not.toContain('{"type": "archive"');
@@ -681,7 +681,7 @@ describe("ArchiveActionExecutor - Canvas Tasks", () => {
681681
const modifyCall = mockVault.modify.mock.calls[0];
682682
const modifiedContent = modifyCall[1];
683683
expect(modifiedContent).toContain(
684-
"- [x] Incomplete task to archive - Completed"
684+
"- [x] Incomplete task to archive ✅ 2025-07-04"
685685
);
686686
expect(modifiedContent).not.toContain("- [ ]"); // Should not contain incomplete checkbox
687687
expect(modifiedContent).not.toContain("🏁");
@@ -739,7 +739,7 @@ describe("ArchiveActionExecutor - Canvas Tasks", () => {
739739
const modifyCall = mockVault.modify.mock.calls[0];
740740
const modifiedContent = modifyCall[1];
741741
expect(modifiedContent).toContain(
742-
"- [x] Task with dataview onCompletion - Completed"
742+
"- [x] Task with dataview onCompletion ✅ 2025-07-04"
743743
);
744744
expect(modifiedContent).not.toContain("[onCompletion::");
745745
expect(modifiedContent).not.toContain("archive:done.md");

src/__tests__/ArchiveActionExecutor.markdown.test.ts

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ describe("ArchiveActionExecutor - Markdown Tasks", () => {
6161
line: 3,
6262
completed: true,
6363
status: "x",
64-
originalMarkdown: "- [x] Task with onCompletion 🏁 archive:done.md",
64+
originalMarkdown:
65+
"- [x] Task with onCompletion 🏁 archive:done.md",
6566
metadata: {
6667
tags: [],
6768
children: [],
@@ -86,7 +87,8 @@ describe("ArchiveActionExecutor - Markdown Tasks", () => {
8687
.mockReturnValueOnce({ path: "Archive/Completed Tasks.md" }); // Archive file
8788

8889
// Mock file contents
89-
const sourceContent = "# Tasks\n\n- [ ] Other task\n- [x] Task with onCompletion 🏁 archive:done.md\n- [ ] Another task";
90+
const sourceContent =
91+
"# Tasks\n\n- [ ] Other task\n- [x] Task with onCompletion 🏁 archive:done.md\n- [ ] Another task";
9092
const archiveContent = "# Archive\n\n## Completed Tasks\n\n";
9193

9294
mockVault.read
@@ -98,17 +100,23 @@ describe("ArchiveActionExecutor - Markdown Tasks", () => {
98100
const result = await executor.execute(mockContext, archiveConfig);
99101

100102
expect(result.success).toBe(true);
101-
expect(result.message).toContain("Task archived to Archive/Completed Tasks.md");
103+
expect(result.message).toContain(
104+
"Task archived to Archive/Completed Tasks.md"
105+
);
102106

103107
// Verify source file was updated (task removed)
104108
const sourceModifyCall = mockVault.modify.mock.calls[0];
105109
const updatedSourceContent = sourceModifyCall[1];
106-
expect(updatedSourceContent).toBe("# Tasks\n\n- [ ] Other task\n- [ ] Another task");
110+
expect(updatedSourceContent).toBe(
111+
"# Tasks\n\n- [ ] Other task\n- [ ] Another task"
112+
);
107113

108114
// Verify archive file was updated (task added without onCompletion metadata)
109115
const archiveModifyCall = mockVault.modify.mock.calls[1];
110116
const updatedArchiveContent = archiveModifyCall[1];
111-
expect(updatedArchiveContent).toContain("- [x] Task with onCompletion - Completed");
117+
expect(updatedArchiveContent).toContain(
118+
"- [x] Task with onCompletion ✅ 2025-07-04 (from source.md)"
119+
);
112120
expect(updatedArchiveContent).not.toContain("🏁");
113121
expect(updatedArchiveContent).not.toContain("archive:done.md");
114122
expect(updatedArchiveContent).toMatch(/\d{4}-\d{2}-\d{2}/); // Date pattern
@@ -147,7 +155,8 @@ describe("ArchiveActionExecutor - Markdown Tasks", () => {
147155
.mockReturnValueOnce({ path: "Archive/Completed Tasks.md" }); // Archive file
148156

149157
// Mock file contents
150-
const sourceContent = "# Tasks\n- [ ] Incomplete task to archive 🏁 archive\n- [ ] Other task";
158+
const sourceContent =
159+
"# Tasks\n- [ ] Incomplete task to archive 🏁 archive\n- [ ] Other task";
151160
const archiveContent = "# Archive\n\n## Completed Tasks\n\n";
152161

153162
mockVault.read
@@ -163,7 +172,9 @@ describe("ArchiveActionExecutor - Markdown Tasks", () => {
163172
// Verify archive file contains completed task without onCompletion metadata
164173
const archiveModifyCall = mockVault.modify.mock.calls[1];
165174
const updatedArchiveContent = archiveModifyCall[1];
166-
expect(updatedArchiveContent).toContain("- [x] Incomplete task to archive - Completed");
175+
expect(updatedArchiveContent).toContain(
176+
"- [x] Incomplete task to archive ✅ 2025-07-04 (from source.md)"
177+
);
167178
expect(updatedArchiveContent).not.toContain("- [ ]"); // Should not contain incomplete checkbox
168179
expect(updatedArchiveContent).not.toContain("🏁");
169180
});
@@ -176,7 +187,8 @@ describe("ArchiveActionExecutor - Markdown Tasks", () => {
176187
line: 0,
177188
completed: true,
178189
status: "x",
179-
originalMarkdown: "- [x] Task with dataview onCompletion [onCompletion:: archive:done.md]",
190+
originalMarkdown:
191+
"- [x] Task with dataview onCompletion [onCompletion:: archive:done.md]",
180192
metadata: {
181193
tags: [],
182194
children: [],
@@ -201,7 +213,8 @@ describe("ArchiveActionExecutor - Markdown Tasks", () => {
201213
.mockReturnValueOnce({ path: "Archive/Completed Tasks.md" }); // Archive file
202214

203215
// Mock file contents
204-
const sourceContent = "- [x] Task with dataview onCompletion [onCompletion:: archive:done.md]";
216+
const sourceContent =
217+
"- [x] Task with dataview onCompletion [onCompletion:: archive:done.md]";
205218
const archiveContent = "# Archive\n\n## Completed Tasks\n\n";
206219

207220
mockVault.read
@@ -217,7 +230,9 @@ describe("ArchiveActionExecutor - Markdown Tasks", () => {
217230
// Verify archive file contains task without dataview onCompletion metadata
218231
const archiveModifyCall = mockVault.modify.mock.calls[1];
219232
const updatedArchiveContent = archiveModifyCall[1];
220-
expect(updatedArchiveContent).toContain("- [x] Task with dataview onCompletion - Completed");
233+
expect(updatedArchiveContent).toContain(
234+
"- [x] Task with dataview onCompletion ✅ 2025-07-04 (from source.md)"
235+
);
221236
expect(updatedArchiveContent).not.toContain("[onCompletion::");
222237
expect(updatedArchiveContent).not.toContain("archive:done.md");
223238
});
@@ -230,11 +245,13 @@ describe("ArchiveActionExecutor - Markdown Tasks", () => {
230245
line: 0,
231246
completed: true,
232247
status: "x",
233-
originalMarkdown: '- [x] Task with JSON onCompletion 🏁 {"type": "archive", "archiveFile": "custom.md"}',
248+
originalMarkdown:
249+
'- [x] Task with JSON onCompletion 🏁 {"type": "archive", "archiveFile": "custom.md"}',
234250
metadata: {
235251
tags: [],
236252
children: [],
237-
onCompletion: '{"type": "archive", "archiveFile": "custom.md"}',
253+
onCompletion:
254+
'{"type": "archive", "archiveFile": "custom.md"}',
238255
},
239256
};
240257

@@ -255,7 +272,8 @@ describe("ArchiveActionExecutor - Markdown Tasks", () => {
255272
.mockReturnValueOnce({ path: "Archive/Completed Tasks.md" }); // Archive file
256273

257274
// Mock file contents
258-
const sourceContent = '- [x] Task with JSON onCompletion 🏁 {"type": "archive", "archiveFile": "custom.md"}';
275+
const sourceContent =
276+
'- [x] Task with JSON onCompletion 🏁 {"type": "archive", "archiveFile": "custom.md"}';
259277
const archiveContent = "# Archive\n\n## Completed Tasks\n\n";
260278

261279
mockVault.read
@@ -271,7 +289,9 @@ describe("ArchiveActionExecutor - Markdown Tasks", () => {
271289
// Verify archive file contains task without JSON onCompletion metadata
272290
const archiveModifyCall = mockVault.modify.mock.calls[1];
273291
const updatedArchiveContent = archiveModifyCall[1];
274-
expect(updatedArchiveContent).toContain("- [x] Task with JSON onCompletion - Completed");
292+
expect(updatedArchiveContent).toContain(
293+
"- [x] Task with JSON onCompletion ✅ 2025-07-04 (from source.md)"
294+
);
275295
expect(updatedArchiveContent).not.toContain("🏁");
276296
expect(updatedArchiveContent).not.toContain('{"type": "archive"');
277297
});
@@ -312,4 +332,4 @@ describe("ArchiveActionExecutor - Markdown Tasks", () => {
312332
expect(result.error).toContain("Source file not found: missing.md");
313333
});
314334
});
315-
});
335+
});

0 commit comments

Comments
 (0)