@@ -9,43 +9,67 @@ test('returns empty array for non-array input', () => {
99 assert . deepEqual ( result , [ ] ) ;
1010} ) ;
1111
12- test ( 'sorts tasks by completion status, priority, and created_at' , ( ) => {
12+ test ( 'sorts tasks by completion status, priority, importance, and created_at' , ( ) => {
1313 const todos = [
14- { id : 1 , is_completed : false , priority : 'medium ' , created_at : '2025-10-20T10:00:00Z' } ,
15- { id : 2 , is_completed : true , priority : 'high ' , created_at : '2025-10-21T09:00:00Z' } ,
16- { id : 3 , is_completed : false , priority : 'urgent' , created_at : '2025-10-19T12:00:00Z' } ,
17- { id : 4 , is_completed : false , priority : 'low ' , created_at : '2025-10-22T08:00:00Z' } ,
14+ { id : 1 , is_completed : false , priority : 'not_urgent' , importance : 'important ', created_at : '2025-10-20T10:00:00Z' } ,
15+ { id : 2 , is_completed : true , priority : 'urgent' , importance : 'important ', created_at : '2025-10-21T09:00:00Z' } ,
16+ { id : 3 , is_completed : false , priority : 'urgent' , importance : 'not_important' , created_at : '2025-10-19T12:00:00Z' } ,
17+ { id : 4 , is_completed : false , priority : 'not_urgent' , importance : 'not_important ', created_at : '2025-10-22T08:00:00Z' } ,
1818 ] ;
1919
2020 const result = filterAndSortTodos ( todos , null , false ) ;
2121
2222 assert . deepEqual ( result . map ( ( todo ) => todo . id ) , [ 3 , 1 , 4 , 2 ] ) ;
2323} ) ;
2424
25- test ( 'filters by high priority' , ( ) => {
25+ test ( 'filters by urgent priority' , ( ) => {
2626 const todos = [
27- { id : 1 , is_completed : false , priority : 'high ' , created_at : '2025-10-20T10:00:00Z' } ,
28- { id : 2 , is_completed : false , priority : 'medium ' , created_at : '2025-10-20T11:00:00Z' } ,
29- { id : 3 , is_completed : false , priority : 'urgent' , created_at : '2025-10-20T12:00:00Z' } ,
27+ { id : 1 , is_completed : false , priority : 'urgent' , importance : 'important ', created_at : '2025-10-20T10:00:00Z' } ,
28+ { id : 2 , is_completed : false , priority : 'not_urgent' , importance : 'important ', created_at : '2025-10-20T11:00:00Z' } ,
29+ { id : 3 , is_completed : false , priority : 'urgent' , importance : 'not_important' , created_at : '2025-10-20T12:00:00Z' } ,
3030 ] ;
3131
32- const result = filterAndSortTodos ( todos , 'high_priority ' , false ) ;
32+ const result = filterAndSortTodos ( todos , 'urgent ' , false ) ;
3333
34- assert . deepEqual ( result . map ( ( todo ) => todo . id ) , [ 3 , 1 ] ) ;
34+ assert . deepEqual ( result . map ( ( todo ) => todo . id ) , [ 1 , 3 ] ) ;
3535} ) ;
3636
37- test ( 'filters by low priority' , ( ) => {
37+ test ( 'filters by not urgent priority' , ( ) => {
3838 const todos = [
39- { id : 1 , is_completed : false , priority : 'high ' , created_at : '2025-10-20T10:00:00Z' } ,
40- { id : 2 , is_completed : false , priority : 'medium ' , created_at : '2025-10-20T11:00:00Z' } ,
41- { id : 3 , is_completed : false , priority : 'low ' , created_at : '2025-10-20T12:00:00Z' } ,
39+ { id : 1 , is_completed : false , priority : 'urgent' , importance : 'important ', created_at : '2025-10-20T10:00:00Z' } ,
40+ { id : 2 , is_completed : false , priority : 'not_urgent' , importance : 'important ', created_at : '2025-10-20T11:00:00Z' } ,
41+ { id : 3 , is_completed : false , priority : 'not_urgent' , importance : 'not_important ', created_at : '2025-10-20T12:00:00Z' } ,
4242 ] ;
4343
44- const result = filterAndSortTodos ( todos , 'low_priority ' , false ) ;
44+ const result = filterAndSortTodos ( todos , 'not_urgent ' , false ) ;
4545
4646 assert . deepEqual ( result . map ( ( todo ) => todo . id ) , [ 2 , 3 ] ) ;
4747} ) ;
4848
49+ test ( 'filters by important importance' , ( ) => {
50+ const todos = [
51+ { id : 1 , is_completed : false , priority : 'urgent' , importance : 'important' , created_at : '2025-10-20T10:00:00Z' } ,
52+ { id : 2 , is_completed : false , priority : 'not_urgent' , importance : 'not_important' , created_at : '2025-10-20T11:00:00Z' } ,
53+ { id : 3 , is_completed : false , priority : 'not_urgent' , importance : 'important' , created_at : '2025-10-20T12:00:00Z' } ,
54+ ] ;
55+
56+ const result = filterAndSortTodos ( todos , 'important' , false ) ;
57+
58+ assert . deepEqual ( result . map ( ( todo ) => todo . id ) , [ 1 , 3 ] ) ;
59+ } ) ;
60+
61+ test ( 'filters by not important importance' , ( ) => {
62+ const todos = [
63+ { id : 1 , is_completed : false , priority : 'urgent' , importance : 'not_important' , created_at : '2025-10-20T10:00:00Z' } ,
64+ { id : 2 , is_completed : false , priority : 'not_urgent' , importance : 'not_important' , created_at : '2025-10-20T11:00:00Z' } ,
65+ { id : 3 , is_completed : false , priority : 'urgent' , importance : 'important' , created_at : '2025-10-20T12:00:00Z' } ,
66+ ] ;
67+
68+ const result = filterAndSortTodos ( todos , 'not_important' , false ) ;
69+
70+ assert . deepEqual ( result . map ( ( todo ) => todo . id ) , [ 1 , 2 ] ) ;
71+ } ) ;
72+
4973test ( 'sorts notes by created_at descending' , ( ) => {
5074 const notes = [
5175 { id : 1 , created_at : '2025-10-20T10:00:00Z' } ,
0 commit comments