@@ -90,11 +90,11 @@ describe("printOddNumbers", () => {
9090 const consoleLogSpy = jest . spyOn ( console , "log" ) ;
9191
9292 printOddNumbers ( 10 ) ;
93- expect ( consoleLogSpy ) . toBeCalledWith ( 1 ) ;
94- expect ( consoleLogSpy ) . toBeCalledWith ( 3 ) ;
95- expect ( consoleLogSpy ) . toBeCalledWith ( 5 ) ;
96- expect ( consoleLogSpy ) . toBeCalledWith ( 7 ) ;
97- expect ( consoleLogSpy ) . toBeCalledWith ( 9 ) ;
93+ expect ( consoleLogSpy ) . toHaveBeenNthCalledWith ( 1 , 1 ) ;
94+ expect ( consoleLogSpy ) . toHaveBeenNthCalledWith ( 2 , 3 ) ;
95+ expect ( consoleLogSpy ) . toHaveBeenNthCalledWith ( 3 , 5 ) ;
96+ expect ( consoleLogSpy ) . toHaveBeenNthCalledWith ( 4 , 7 ) ;
97+ expect ( consoleLogSpy ) . toHaveBeenNthCalledWith ( 5 , 9 ) ;
9898
9999 consoleLogSpy . mockRestore ( ) ;
100100 } ) ;
@@ -140,13 +140,14 @@ describe("countReverse", () => {
140140 test ( "countReverse function logs values from 7 to 1" , ( ) => {
141141 const consoleLogSpy = jest . spyOn ( console , "log" ) ;
142142
143- expect ( consoleLogSpy ) . toBeCalledWith ( 7 ) ;
144- expect ( consoleLogSpy ) . toBeCalledWith ( 6 ) ;
145- expect ( consoleLogSpy ) . toBeCalledWith ( 5 ) ;
146- expect ( consoleLogSpy ) . toBeCalledWith ( 4 ) ;
147- expect ( consoleLogSpy ) . toBeCalledWith ( 3 ) ;
148- expect ( consoleLogSpy ) . toBeCalledWith ( 2 ) ;
149- expect ( consoleLogSpy ) . toBeCalledWith ( 1 ) ;
143+ countReverse ( 7 ) ;
144+ expect ( consoleLogSpy ) . toHaveBeenNthCalledWith ( 1 , 7 ) ;
145+ expect ( consoleLogSpy ) . toHaveBeenNthCalledWith ( 2 , 6 ) ;
146+ expect ( consoleLogSpy ) . toHaveBeenNthCalledWith ( 3 , 5 ) ;
147+ expect ( consoleLogSpy ) . toHaveBeenNthCalledWith ( 4 , 4 ) ;
148+ expect ( consoleLogSpy ) . toHaveBeenNthCalledWith ( 5 , 3 ) ;
149+ expect ( consoleLogSpy ) . toHaveBeenNthCalledWith ( 6 , 2 ) ;
150+ expect ( consoleLogSpy ) . toHaveBeenNthCalledWith ( 7 , 1 ) ;
150151
151152 consoleLogSpy . mockRestore ( ) ;
152153 } ) ;
0 commit comments