Skip to content

Commit b304eeb

Browse files
committed
test: use toFileLineString() to show the task completion
1 parent aa2bc9c commit b304eeb

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

β€Žtests/Task.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,12 +1139,12 @@ describe('next task recurrence appearance', () => {
11391139
const task = fromLine({ line: '- [ ] this is a recurring task πŸ” every day' });
11401140

11411141
// Act
1142-
const tasks = task.toggle();
1142+
const lines = task.toggle().map((t) => t.toFileLineString());
11431143

11441144
// Assert
1145-
expect(tasks.length).toEqual(2);
1146-
expect(tasks[0].toString()).toMatchInlineSnapshot('"this is a recurring task πŸ” every day"');
1147-
expect(tasks[1].toString()).toMatchInlineSnapshot('"this is a recurring task πŸ” every day βœ… 2023-05-16"');
1145+
expect(lines.length).toEqual(2);
1146+
expect(lines[0]).toMatchInlineSnapshot('"- [ ] this is a recurring task πŸ” every day"');
1147+
expect(lines[1]).toMatchInlineSnapshot('"- [x] this is a recurring task πŸ” every day βœ… 2023-05-16"');
11481148
});
11491149

11501150
it('new task shall appear on next line with the setting set to false', () => {
@@ -1153,12 +1153,12 @@ describe('next task recurrence appearance', () => {
11531153
updateSettings({ recurrenceOnNextLine: false });
11541154

11551155
// Act
1156-
const tasks = task.toggle();
1156+
const lines = task.toggle().map((t) => t.toFileLineString());
11571157

11581158
// Assert
1159-
expect(tasks.length).toEqual(2);
1160-
expect(tasks[0].toString()).toMatchInlineSnapshot('"this is a recurring task πŸ” every day"');
1161-
expect(tasks[1].toString()).toMatchInlineSnapshot('"this is a recurring task πŸ” every day βœ… 2023-05-16"');
1159+
expect(lines.length).toEqual(2);
1160+
expect(lines[0]).toMatchInlineSnapshot('"- [ ] this is a recurring task πŸ” every day"');
1161+
expect(lines[1]).toMatchInlineSnapshot('"- [x] this is a recurring task πŸ” every day βœ… 2023-05-16"');
11621162
});
11631163

11641164
it('new task shall appear on next line with the setting set to true', () => {
@@ -1167,12 +1167,12 @@ describe('next task recurrence appearance', () => {
11671167
updateSettings({ recurrenceOnNextLine: true });
11681168

11691169
// Act
1170-
const tasks = task.toggle();
1170+
const lines = task.toggle().map((t) => t.toFileLineString());
11711171

11721172
// Assert
1173-
expect(tasks.length).toEqual(2);
1174-
expect(tasks[0].toString()).toMatchInlineSnapshot('"this is a recurring task πŸ” every day βœ… 2023-05-16"');
1175-
expect(tasks[1].toString()).toMatchInlineSnapshot('"this is a recurring task πŸ” every day"');
1173+
expect(lines.length).toEqual(2);
1174+
expect(lines[0]).toMatchInlineSnapshot('"- [x] this is a recurring task πŸ” every day βœ… 2023-05-16"');
1175+
expect(lines[1]).toMatchInlineSnapshot('"- [ ] this is a recurring task πŸ” every day"');
11761176
});
11771177
});
11781178

0 commit comments

Comments
Β (0)