File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,9 @@ function extractPromisesFromObject(obj) {
9494 Object . keys ( obj ) . forEach ( ( key ) => {
9595 promises . push ( ...extractPromisesFromObject ( obj [ key ] ) ) ;
9696 } ) ;
97+ Object . getOwnPropertySymbols ( obj ) . forEach ( ( key ) => {
98+ promises . push ( ...extractPromisesFromObject ( obj [ key ] ) ) ;
99+ } ) ;
97100 return promises ;
98101 }
99102 return [ ] ;
Original file line number Diff line number Diff line change @@ -113,6 +113,31 @@ if (
113113 '}'
114114 ) ;
115115 } ) ;
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+ } ) ;
116141 } ) ;
117142 } ) ;
118143}
You can’t perform that action at this time.
0 commit comments