Skip to content

Commit b58a037

Browse files
committed
test: Add toToggleWithRecurrenceInUsersOrderTo()
1 parent 2abfc4a commit b58a037

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

tests/CustomMatchers/CustomMatchersForTasks.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@ declare global {
55
namespace jest {
66
interface Matchers<R> {
77
toToggleLineTo(expectedLines: string[]): R;
8+
toToggleWithRecurrenceInUsersOrderTo(expectedLines: string[]): R;
89
}
910

1011
interface Expect {
1112
toToggleLineTo(expectedLines: string[]): any;
13+
toToggleWithRecurrenceInUsersOrderTo(expectedLines: string[]): any;
1214
}
1315

1416
interface InverseAsymmetricMatchers {
1517
toToggleLineTo(expectedLines: string[]): any;
18+
toToggleWithRecurrenceInUsersOrderTo(expectedLines: string[]): any;
1619
}
1720
}
1821
}
@@ -23,6 +26,12 @@ export function toToggleLineTo(line: string, expectedLines: string[]) {
2326
return toMatchLines(receivedLines, expectedLines);
2427
}
2528

29+
export function toToggleWithRecurrenceInUsersOrderTo(line: string, expectedLines: string[]) {
30+
const task = fromLine({ line: line });
31+
const receivedLines = task.toggleWithRecurrenceInUsersOrder().map((t) => t.toFileLineString());
32+
return toMatchLines(receivedLines, expectedLines);
33+
}
34+
2635
function toMatchLines(receivedLines: string[], expectedLines: string[]) {
2736
const matches = receivedLines.join('\n') === expectedLines.join('\n');
2837
if (!matches) {

tests/CustomMatchers/jest.custom_matchers.setup.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ expect.extend({
3939
// ---------------------------------------------------------------------
4040
// CustomMatchersForTasks
4141
// ---------------------------------------------------------------------
42-
import { toToggleLineTo } from './CustomMatchersForTasks';
42+
import { toToggleLineTo, toToggleWithRecurrenceInUsersOrderTo } from './CustomMatchersForTasks';
4343
expect.extend({
4444
toToggleLineTo,
45+
toToggleWithRecurrenceInUsersOrderTo,
4546
});
4647

4748
// ---------------------------------------------------------------------

0 commit comments

Comments
 (0)