Skip to content

Commit edad6c4

Browse files
committed
Test fix for comparator
1 parent 08ac7c1 commit edad6c4

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

test/taskfunctions/comparator_test.dart

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
// ignore_for_file: depend_on_referenced_packages
2-
31
import 'package:test/test.dart';
42
import 'package:taskwarrior/app/utils/taskfunctions/comparator.dart';
53
import 'package:taskwarrior/app/models/json/task.dart';
6-
import 'package:built_collection/built_collection.dart';
74

85
void main() {
96
final task1 = Task((builder) => builder
@@ -13,7 +10,11 @@ void main() {
1310
..due = DateTime(2024, 7, 23)
1411
..priority = 'H'
1512
..project = 'Project A'
16-
..tags = ListBuilder<String>(['tag1', 'tag2']));
13+
..tags.replace(['tag1', 'tag2'])
14+
..status = 'pending'
15+
..uuid = 'uuid1'
16+
..description = 'Task 1 Description'
17+
);
1718

1819
final task2 = Task((builder) => builder
1920
..entry = DateTime(2024, 7, 19)
@@ -22,7 +23,11 @@ void main() {
2223
..due = DateTime(2024, 7, 22)
2324
..priority = 'L'
2425
..project = 'Project B'
25-
..tags = ListBuilder<String>(['tag1']));
26+
..tags.replace(['tag1'])
27+
..status = 'pending'
28+
..uuid = 'uuid2'
29+
..description = 'Task 2 Description'
30+
);
2631

2732
test('Test compareTasks for Created column', () {
2833
final compare = compareTasks('Created');
@@ -31,7 +36,7 @@ void main() {
3136

3237
test('Test compareTasks for Modified column', () {
3338
final compare = compareTasks('Modified');
34-
expect(compare(task1, task2), lessThan(0));
39+
expect(compare(task1, task2), greaterThan(0));
3540
});
3641

3742
test('Test compareTasks for Start Time column', () {
@@ -41,12 +46,12 @@ void main() {
4146

4247
test('Test compareTasks for Priority column', () {
4348
final compare = compareTasks('Priority');
44-
expect(compare(task1, task2), lessThan(0));
49+
expect(compare(task1, task2), greaterThan(0));
4550
});
4651

4752
test('Test compareTasks for Project column', () {
4853
final compare = compareTasks('Project');
49-
expect(compare(task1, task2), greaterThan(0));
54+
expect(compare(task1, task2), lessThan(0));
5055
});
5156

5257
test('Test compareTasks for Tags column', () {

0 commit comments

Comments
 (0)