File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,9 @@ function extractPromisesFromObject(obj) {
94
94
Object . keys ( obj ) . forEach ( ( key ) => {
95
95
promises . push ( ...extractPromisesFromObject ( obj [ key ] ) ) ;
96
96
} ) ;
97
+ Object . getOwnPropertySymbols ( obj ) . forEach ( ( key ) => {
98
+ promises . push ( ...extractPromisesFromObject ( obj [ key ] ) ) ;
99
+ } ) ;
97
100
return promises ;
98
101
}
99
102
return [ ] ;
Original file line number Diff line number Diff line change @@ -113,6 +113,31 @@ if (
113
113
'}'
114
114
) ;
115
115
} ) ;
116
+
117
+ describe ( 'when only symbol properties differ' , function ( ) {
118
+ // Regression test for not looping over Object.getOwnPropertySymbols(obj)
119
+ // in expect.promise.{any,all,settle} when an object is passed:
120
+ it ( 'should error and include the Symbol properties in the diff' , ( ) => {
121
+ const a = { } ;
122
+ a [ symbolA ] = 'foo' ;
123
+ const b = { } ;
124
+ b [ symbolA ] = 'bar' ;
125
+ expect (
126
+ function ( ) {
127
+ expect ( a , 'to satisfy' , b ) ;
128
+ } ,
129
+ 'to throw' ,
130
+ "expected { [Symbol('a')]: 'foo' } to satisfy { [Symbol('a')]: 'bar' }\n" +
131
+ '\n' +
132
+ '{\n' +
133
+ " [Symbol('a')]: 'foo' // should equal 'bar'\n" +
134
+ ' //\n' +
135
+ ' // -foo\n' +
136
+ ' // +bar\n' +
137
+ '}'
138
+ ) ;
139
+ } ) ;
140
+ } ) ;
116
141
} ) ;
117
142
} ) ;
118
143
}
You can’t perform that action at this time.
0 commit comments