11import { jest } from "@jest/globals" ;
22import { mockPlugin , mockApp } from "./test-helpers.js" ;
33
4- // --------------------------------------------------------------------------------------
54describe ( "Bulk Task Reset Plugin" , ( ) => {
65 const plugin = mockPlugin ( ) ;
76 plugin . constants . isTestEnvironment = true ;
@@ -11,10 +10,7 @@ describe("Bulk Task Reset Plugin", () => {
1110 app . getTaskDomains = jest . fn ( ) . mockResolvedValue ( [ ] ) ;
1211 app . alert = jest . fn ( ) ;
1312
14- await plugin . taskOption [ "Bulk Actions - Clear Overdue Tasks" ] . run (
15- app ,
16- "test-note-uuid"
17- ) ;
13+ await plugin . taskOption [ "Clear Overdue Tasks" ] . run ( app , "test-note-uuid" ) ;
1814
1915 expect ( app . alert ) . toHaveBeenCalledWith ( "No task domains found." ) ;
2016 } ) ;
@@ -31,15 +27,12 @@ describe("Bulk Task Reset Plugin", () => {
3127 app . getTaskDomainTasks = jest . fn ( ) . mockReturnValue (
3228 ( async function * ( ) {
3329 yield { uuid : "task1" , startAt : thirtyMinutesAgo } ;
34- } ) ( )
30+ } ) ( ) ,
3531 ) ;
3632
3733 app . alert = jest . fn ( ) ;
3834
39- await plugin . taskOption [ "Bulk Actions - Clear Overdue Tasks" ] . run (
40- app ,
41- "test-note-uuid"
42- ) ;
35+ await plugin . taskOption [ "Clear Overdue Tasks" ] . run ( app , "test-note-uuid" ) ;
4336
4437 expect ( app . alert ) . toHaveBeenCalledWith ( "No overdue tasks found." ) ;
4538 } ) ;
@@ -57,7 +50,7 @@ describe("Bulk Task Reset Plugin", () => {
5750 ( async function * ( ) {
5851 yield { uuid : "task1" , startAt : yesterday , content : "Buy groceries" } ;
5952 yield { uuid : "task2" , endAt : yesterday , content : "Call dentist" } ;
60- } ) ( )
53+ } ) ( ) ,
6154 ) ;
6255
6356 app . updateTask = jest . fn ( ) . mockResolvedValue ( true ) ;
@@ -66,31 +59,28 @@ describe("Bulk Task Reset Plugin", () => {
6659 . mockResolvedValueOnce ( 1 ) // User clicks "Reset All"
6760 . mockResolvedValueOnce ( undefined ) ; // Success message
6861
69- await plugin . taskOption [ "Bulk Actions - Clear Overdue Tasks" ] . run (
70- app ,
71- "test-note-uuid"
72- ) ;
62+ await plugin . taskOption [ "Clear Overdue Tasks" ] . run ( app , "test-note-uuid" ) ;
7363
7464 // Check that confirmation message includes domain name, count, and task names
7565 expect ( app . alert ) . toHaveBeenNthCalledWith (
7666 1 ,
7767 expect . stringContaining ( "Found 2 overdue tasks" ) ,
78- expect . any ( Object )
68+ expect . any ( Object ) ,
7969 ) ;
8070 expect ( app . alert ) . toHaveBeenNthCalledWith (
8171 1 ,
8272 expect . stringContaining ( "My Tasks (2)" ) ,
83- expect . any ( Object )
73+ expect . any ( Object ) ,
8474 ) ;
8575 expect ( app . alert ) . toHaveBeenNthCalledWith (
8676 1 ,
8777 expect . stringContaining ( "Buy groceries" ) ,
88- expect . any ( Object )
78+ expect . any ( Object ) ,
8979 ) ;
9080 expect ( app . alert ) . toHaveBeenNthCalledWith (
9181 1 ,
9282 expect . stringContaining ( "Call dentist" ) ,
93- expect . any ( Object )
83+ expect . any ( Object ) ,
9484 ) ;
9585
9686 expect ( app . updateTask ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -110,16 +100,13 @@ describe("Bulk Task Reset Plugin", () => {
110100 app . getTaskDomainTasks = jest . fn ( ) . mockReturnValue (
111101 ( async function * ( ) {
112102 yield { uuid : "task1" , startAt : yesterday } ;
113- } ) ( )
103+ } ) ( ) ,
114104 ) ;
115105
116106 app . updateTask = jest . fn ( ) ;
117107 app . alert = jest . fn ( ) . mockResolvedValue ( 0 ) ; // User clicks "Cancel"
118108
119- await plugin . taskOption [ "Bulk Actions - Clear Overdue Tasks" ] . run (
120- app ,
121- "test-note-uuid"
122- ) ;
109+ await plugin . taskOption [ "Clear Overdue Tasks" ] . run ( app , "test-note-uuid" ) ;
123110
124111 expect ( app . updateTask ) . not . toHaveBeenCalled ( ) ;
125112 } ) ;
0 commit comments