Skip to content

Commit 409d8f0

Browse files
committed
test: Automate the resetting of settings
1 parent 9d28a8a commit 409d8f0

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

tests/Task.test.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,10 @@ describe('toggle done', () => {
10191019
});
10201020

10211021
describe('set correct created date on reccurence task', () => {
1022+
afterEach(() => {
1023+
resetSettings();
1024+
});
1025+
10221026
it('does not set created date with disabled setting', () => {
10231027
// Arrange
10241028
const line = '- [ ] this is a task 📅 2021-09-12 🔁 every day';
@@ -1037,9 +1041,6 @@ describe('set correct created date on reccurence task', () => {
10371041
expect(tasks.length).toEqual(2);
10381042
const nextTask: Task = tasks[0];
10391043
expect(nextTask.createdDate).toBeNull();
1040-
1041-
// cleanup
1042-
resetSettings();
10431044
});
10441045

10451046
it('does not set created date with disabled setting when repeated has created date', () => {
@@ -1061,9 +1062,6 @@ describe('set correct created date on reccurence task', () => {
10611062
expect(tasks.length).toEqual(2);
10621063
const nextTask: Task = tasks[0];
10631064
expect(nextTask.createdDate).toBeNull();
1064-
1065-
// cleanup
1066-
resetSettings();
10671065
});
10681066

10691067
it('set created date with enabled setting', () => {
@@ -1089,7 +1087,6 @@ describe('set correct created date on reccurence task', () => {
10891087
expect(nextTask!.createdDate!.isSame(moment(today, 'YYYY-MM-DD'))).toStrictEqual(true);
10901088

10911089
// cleanup
1092-
resetSettings();
10931090
todaySpy.mockClear();
10941091
});
10951092

@@ -1117,7 +1114,6 @@ describe('set correct created date on reccurence task', () => {
11171114
expect(nextTask!.createdDate!.isSame(moment(today, 'YYYY-MM-DD'))).toStrictEqual(true);
11181115

11191116
// cleanup
1120-
resetSettings();
11211117
todaySpy.mockClear();
11221118
});
11231119
});

0 commit comments

Comments
 (0)