Skip to content

Commit

Permalink
test: - Add failing test for #2867
Browse files Browse the repository at this point in the history
  • Loading branch information
claremacrae committed Jun 27, 2024
1 parent 173945c commit 81e8e59
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/Task/Task.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,7 @@ describe('toggle done', () => {
start?: string;
today?: string;
// results:
expectedDone?: string; // TODO Remove this and use today as expected done date, when #2867 is fixed
doneSymbol?: string; // the symbol of the completed task
nextSymbol?: string; // the symbol of the recurrence
nextDue?: string;
Expand Down Expand Up @@ -1141,6 +1142,7 @@ describe('toggle done', () => {
start,
today,
// results:
expectedDone,
doneSymbol,
nextSymbol,
nextDue,
Expand Down Expand Up @@ -1183,6 +1185,14 @@ describe('toggle done', () => {
const nextTask: Task = tasks[0];

expect(doneTask.status.symbol).toEqual(doneSymbol ?? 'x');
if (expectedDone) {
expect({
doneDate: doneTask.doneDate?.format('YYYY-MM-DD'),
}).toMatchObject({
doneDate: expectedDone,
});
}

expect(nextTask.status.symbol).toEqual(nextSymbol ?? ' ');
expect({
nextDue: nextTask.dueDate?.format('YYYY-MM-DD'),
Expand Down Expand Up @@ -1268,6 +1278,28 @@ describe('toggle done', () => {
`);
});
});

it('should apply the correct done date - without "when done"', () => {
const today = '2024-05-31';
testRecurrenceCase({
today: today,
scheduled: today,
interval: 'every 6 months',
nextScheduled: '2024-11-30',
expectedDone: today,
});
});

it.failing('should apply the correct done date - with "when done"', () => {
const today = '2024-05-31';
testRecurrenceCase({
today: today,
scheduled: today,
interval: 'every 6 months when done',
nextScheduled: '2024-11-30',
expectedDone: today, // fails - gives '2024-05-30'
});
});
});

describe('handle new status', () => {
Expand Down

0 comments on commit 81e8e59

Please sign in to comment.