Skip to content

Commit ed2c7d4

Browse files
committed
test: Rework tests to use toToggleWithRecurrenceInUsersOrderTo()
1 parent b58a037 commit ed2c7d4

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

β€Žtests/Task.test.ts

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,19 +1090,9 @@ describe('order of recurring tasks', () => {
10901090
resetSettings();
10911091
});
10921092

1093-
function togglingInUsersOrderShouldGive(line: string, expectedLines: string[]) {
1094-
// Arrange
1095-
const task = fromLine({ line: line });
1096-
1097-
// Act
1098-
const lines = task.toggleWithRecurrenceInUsersOrder().map((t) => t.toFileLineString());
1099-
1100-
// Assert
1101-
expect(lines).toStrictEqual(expectedLines);
1102-
}
1103-
11041093
it('should put new task before old, by default', () => {
1105-
togglingInUsersOrderShouldGive('- [ ] this is a recurring task πŸ” every day', [
1094+
const line = '- [ ] this is a recurring task πŸ” every day';
1095+
expect(line).toToggleWithRecurrenceInUsersOrderTo([
11061096
'- [ ] this is a recurring task πŸ” every day',
11071097
'- [x] this is a recurring task πŸ” every day βœ… 2023-05-16',
11081098
]);
@@ -1111,7 +1101,8 @@ describe('order of recurring tasks', () => {
11111101
it('should honour new-task-before-old setting', () => {
11121102
updateSettings({ recurrenceOnNextLine: false });
11131103

1114-
togglingInUsersOrderShouldGive('- [ ] this is a recurring task πŸ” every day', [
1104+
const line = '- [ ] this is a recurring task πŸ” every day';
1105+
expect(line).toToggleWithRecurrenceInUsersOrderTo([
11151106
'- [ ] this is a recurring task πŸ” every day',
11161107
'- [x] this is a recurring task πŸ” every day βœ… 2023-05-16',
11171108
]);
@@ -1120,7 +1111,8 @@ describe('order of recurring tasks', () => {
11201111
it('should honour old-task-before-new setting', () => {
11211112
updateSettings({ recurrenceOnNextLine: true });
11221113

1123-
togglingInUsersOrderShouldGive('- [ ] this is a recurring task πŸ” every day', [
1114+
const line = '- [ ] this is a recurring task πŸ” every day';
1115+
expect(line).toToggleWithRecurrenceInUsersOrderTo([
11241116
'- [x] this is a recurring task πŸ” every day βœ… 2023-05-16',
11251117
'- [ ] this is a recurring task πŸ” every day',
11261118
]);

0 commit comments

Comments
Β (0)