File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change
1
+ import { matcherHint , printExpected , printReceived } from 'jest-matcher-utils' ;
1
2
import { SubscriptionLog } from 'rxjs/testing/SubscriptionLog' ;
2
3
import { TestMessage } from '../message/TestMessage' ;
3
4
import { constructSubscriptionMarble } from './constructSubscriptionMarble' ;
@@ -14,8 +15,19 @@ const subscriptionMarbleAssert = (source: SubscriptionLog) => (expected: Subscri
14
15
const sourceMarble = constructSubscriptionMarble ( source ) ;
15
16
const expectedMarble = constructSubscriptionMarble ( expected ) ;
16
17
17
- if ( sourceMarble !== expectedMarble ) {
18
- throw new Error ( 'unmatch!' ) ;
18
+ if (
19
+ sourceMarble . marbleString !== expectedMarble . marbleString ||
20
+ sourceMarble . frameString !== expectedMarble . frameString
21
+ ) {
22
+ const description = `${ matcherHint ( ' to equal ' , JSON . stringify ( source ) , JSON . stringify ( expected ) ) }
23
+
24
+ ${ printReceived ( `Source: ${ sourceMarble . marbleString } ` ) }
25
+ ${ printReceived ( ` ${ sourceMarble . frameString } ` ) }
26
+ ${ printExpected ( `Expected: ${ expectedMarble . marbleString } ` ) }
27
+ ${ printExpected ( ` ${ expectedMarble . frameString } ` ) }
28
+ ` ;
29
+
30
+ throw new Error ( description ) ;
19
31
}
20
32
} ;
21
33
You can’t perform that action at this time.
0 commit comments