Skip to content

Commit aeab23c

Browse files
committed
test: - Reuse createChildListItem() to silence SonarCloud warning: typescript:S1848
1 parent 1637e2f commit aeab23c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/Task/ListItem.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ describe('identicalTo', () => {
115115

116116
it('should recognise list items with different number of children', () => {
117117
const item1 = new ListItem('- item', null);
118-
new ListItem('- child of item1', item1);
118+
createChildListItem('- child of item1', item1);
119119

120120
const item2 = new ListItem('- item', null);
121121

@@ -127,7 +127,7 @@ describe('identicalTo', () => {
127127
createChildListItem('- child of item1', item1);
128128

129129
const item2 = new ListItem('- item', null);
130-
new ListItem('- child of item2', item2);
130+
createChildListItem('- child of item2', item2);
131131

132132
expect(item2.identicalTo(item1)).toEqual(false);
133133
});

tests/Task/Task.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import moment from 'moment';
55
import { verifyAll } from 'approvals/lib/Providers/Jest/JestApprovals';
66
import { TasksFile } from '../../src/Scripting/TasksFile';
77
import { Status } from '../../src/Statuses/Status';
8-
import { ListItem } from '../../src/Task/ListItem';
98
import { Task } from '../../src/Task/Task';
109
import { resetSettings, updateSettings } from '../../src/Config/Settings';
1110
import { GlobalFilter } from '../../src/Config/GlobalFilter';
@@ -23,6 +22,7 @@ import type { TasksDate } from '../../src/DateTime/TasksDate';
2322
import { example_kanban } from '../Obsidian/__test_data__/example_kanban';
2423
import { jason_properties } from '../Obsidian/__test_data__/jason_properties';
2524
import { OnCompletion } from '../../src/Task/OnCompletion';
25+
import { createChildListItem } from './ListItemHelpers';
2626

2727
window.moment = moment;
2828

@@ -1735,16 +1735,16 @@ describe('identicalTo', () => {
17351735
it('should recognise different numbers of child items', () => {
17361736
const task1 = new TaskBuilder().build();
17371737
const task2 = new TaskBuilder().build();
1738-
new ListItem('- child of task2', task2);
1738+
createChildListItem('- child of task2', task2);
17391739

17401740
expect(task2.identicalTo(task1)).toEqual(false);
17411741
});
17421742

17431743
it('should recognise different description in child list items', () => {
17441744
const task1 = new TaskBuilder().build();
17451745
const task2 = new TaskBuilder().build();
1746-
new ListItem('- child of task1', task1);
1747-
new ListItem('- child of task2', task2);
1746+
createChildListItem('- child of task1', task1);
1747+
createChildListItem('- child of task2', task2);
17481748

17491749
expect(task2.identicalTo(task1)).toEqual(false);
17501750
});

0 commit comments

Comments
 (0)