@@ -46,8 +46,7 @@ describe('Mock Timers Test Suite', () => {
46
46
code : 'ERR_INVALID_ARG_VALUE' ,
47
47
} ) ;
48
48
} ) ;
49
-
50
- it ( 'should check that propertyDescriptor gets back after reseting timers' , ( t ) => {
49
+ it ( 'should check that propertyDescriptor gets back after resetting timers' , ( t ) => {
51
50
const getDescriptor = ( ctx , fn ) => Object . getOwnPropertyDescriptor ( ctx , fn ) ;
52
51
const getCurrentTimersDescriptors = ( ) => {
53
52
const timers = [
@@ -71,26 +70,36 @@ describe('Mock Timers Test Suite', () => {
71
70
nodeTimersPromises : nodeTimersPromisesDescriptors ,
72
71
} ;
73
72
} ;
74
- const before = getCurrentTimersDescriptors ( ) ;
73
+
74
+ const originalDescriptors = getCurrentTimersDescriptors ( ) ;
75
+
75
76
t . mock . timers . enable ( ) ;
76
77
const during = getCurrentTimersDescriptors ( ) ;
77
78
t . mock . timers . reset ( ) ;
78
79
const after = getCurrentTimersDescriptors ( ) ;
79
80
80
- assert . deepStrictEqual (
81
- before ,
82
- after ,
83
- ) ;
81
+ for ( const env in originalDescriptors ) {
82
+ for ( const prop in originalDescriptors [ env ] ) {
83
+ const originalDescriptor = originalDescriptors [ env ] [ prop ] ;
84
+ const afterDescriptor = after [ env ] [ prop ] ;
84
85
85
- assert . notDeepStrictEqual (
86
- before ,
87
- during ,
88
- ) ;
86
+ assert . deepStrictEqual (
87
+ originalDescriptor ,
88
+ afterDescriptor ,
89
+ ) ;
89
90
90
- assert . notDeepStrictEqual (
91
- during ,
92
- after ,
93
- ) ;
91
+ assert . notDeepStrictEqual (
92
+ originalDescriptor ,
93
+ during [ env ] [ prop ] ,
94
+ ) ;
95
+
96
+ assert . notDeepStrictEqual (
97
+ during [ env ] [ prop ] ,
98
+ after [ env ] [ prop ] ,
99
+ ) ;
100
+
101
+ }
102
+ }
94
103
} ) ;
95
104
96
105
it ( 'should reset all timers when calling .reset function' , ( t ) => {
0 commit comments