@@ -15,70 +15,82 @@ describe("alerts", () => {
1515 // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1616 const EXPECTED = expect . stringContaining ( TEST_ALERT_MSG ) ;
1717
18- test ( "should print all messages with verbose log level" , ( ) => {
18+ it ( "should print all messages with verbose log level" , ( ) => {
1919 setAlertsLogLevel ( "verbose" ) ;
2020
2121 alerts . error ( TEST_ALERT_MSG ) ;
22+
2223 expect ( console . log ) . toHaveBeenLastCalledWith ( EXPECTED ) ;
2324 //make sure each alert only calls console.log once
24- expect ( console . log ) . toBeCalledTimes ( 1 ) ;
25+ expect ( console . log ) . toHaveBeenCalledTimes ( 1 ) ;
2526
2627 alerts . warn ( TEST_ALERT_MSG ) ;
28+
2729 expect ( console . log ) . toHaveBeenLastCalledWith ( EXPECTED ) ;
28- expect ( console . log ) . toBeCalledTimes ( 2 ) ;
30+ expect ( console . log ) . toHaveBeenCalledTimes ( 2 ) ;
2931
3032 alerts . notice ( TEST_ALERT_MSG ) ;
33+
3134 expect ( console . log ) . toHaveBeenLastCalledWith ( EXPECTED ) ;
32- expect ( console . log ) . toBeCalledTimes ( 3 ) ;
35+ expect ( console . log ) . toHaveBeenCalledTimes ( 3 ) ;
3336
3437 alerts . info ( TEST_ALERT_MSG ) ;
38+
3539 expect ( console . log ) . toHaveBeenLastCalledWith ( EXPECTED ) ;
36- expect ( console . log ) . toBeCalledTimes ( 4 ) ;
40+ expect ( console . log ) . toHaveBeenCalledTimes ( 4 ) ;
3741
3842 alerts . success ( TEST_ALERT_MSG ) ;
43+
3944 expect ( console . log ) . toHaveBeenLastCalledWith ( EXPECTED ) ;
40- expect ( console . log ) . toBeCalledTimes ( 5 ) ;
45+ expect ( console . log ) . toHaveBeenCalledTimes ( 5 ) ;
4146 } ) ;
4247
43- test ( "should only print error messages with error log level" , ( ) => {
48+ it ( "should only print error messages with error log level" , ( ) => {
4449 setAlertsLogLevel ( "error" ) ;
4550
4651 alerts . error ( TEST_ALERT_MSG ) ;
52+
4753 expect ( console . log ) . toHaveBeenLastCalledWith ( EXPECTED ) ;
48- expect ( console . log ) . toBeCalledTimes ( 1 ) ;
54+ expect ( console . log ) . toHaveBeenCalledTimes ( 1 ) ;
4955
5056 alerts . warn ( TEST_ALERT_MSG ) ;
5157 alerts . notice ( TEST_ALERT_MSG ) ;
5258 alerts . info ( TEST_ALERT_MSG ) ;
5359 alerts . success ( TEST_ALERT_MSG ) ;
60+
5461 //shouldn't change
55- expect ( console . log ) . toBeCalledTimes ( 1 ) ;
62+ expect ( console . log ) . toHaveBeenCalledTimes ( 1 ) ;
5663 } ) ;
5764
58- test ( "should print all but warning messages with info log level" , ( ) => {
65+ it ( "should print all but warning messages with info log level" , ( ) => {
5966 setAlertsLogLevel ( "info" ) ;
6067
6168 alerts . error ( TEST_ALERT_MSG ) ;
69+
6270 expect ( console . log ) . toHaveBeenLastCalledWith ( EXPECTED ) ;
63- expect ( console . log ) . toBeCalledTimes ( 1 ) ;
71+ expect ( console . log ) . toHaveBeenCalledTimes ( 1 ) ;
6472
6573 alerts . notice ( TEST_ALERT_MSG ) ;
74+
6675 expect ( console . log ) . toHaveBeenLastCalledWith ( EXPECTED ) ;
67- expect ( console . log ) . toBeCalledTimes ( 2 ) ;
76+ expect ( console . log ) . toHaveBeenCalledTimes ( 2 ) ;
6877
6978 alerts . info ( TEST_ALERT_MSG ) ;
79+
7080 expect ( console . log ) . toHaveBeenLastCalledWith ( EXPECTED ) ;
71- expect ( console . log ) . toBeCalledTimes ( 3 ) ;
81+ expect ( console . log ) . toHaveBeenCalledTimes ( 3 ) ;
7282
7383 alerts . success ( TEST_ALERT_MSG ) ;
84+
7485 expect ( console . log ) . toHaveBeenLastCalledWith ( EXPECTED ) ;
75- expect ( console . log ) . toBeCalledTimes ( 4 ) ;
86+ expect ( console . log ) . toHaveBeenCalledTimes ( 4 ) ;
7687
7788 alerts . warn ( TEST_ALERT_MSG ) ;
78- expect ( console . log ) . toBeCalledTimes ( 4 ) ;
89+
90+ expect ( console . log ) . toHaveBeenCalledTimes ( 4 ) ;
7991 } ) ;
8092
81- test ( "should print no messages with silent log level" , ( ) => {
93+ it ( "should print no messages with silent log level" , ( ) => {
8294 setAlertsLogLevel ( "silent" ) ;
8395
8496 alerts . error ( TEST_ALERT_MSG ) ;
@@ -87,6 +99,6 @@ describe("alerts", () => {
8799 alerts . info ( TEST_ALERT_MSG ) ;
88100 alerts . success ( TEST_ALERT_MSG ) ;
89101
90- expect ( console . log ) . not . toBeCalled ( ) ;
102+ expect ( console . log ) . not . toHaveBeenCalled ( ) ;
91103 } ) ;
92104} ) ;
0 commit comments