File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,7 +76,16 @@ export abstract class BaseRepository implements ExpectationRepository {
7676 return ( ) => 'mock' ;
7777 case '@@toStringTag' :
7878 case Symbol . toStringTag :
79+ case 'name' :
7980 return 'mock' ;
81+
82+ // pretty-format
83+ case '$$typeof' :
84+ case 'constructor' :
85+ case '@@__IMMUTABLE_ITERABLE__@@' :
86+ case '@@__IMMUTABLE_RECORD__@@' :
87+ return null ;
88+
8089 case ApplyProp :
8190 return ( ...args : any [ ] ) => {
8291 this . recordUnexpected ( property , args ) ;
Original file line number Diff line number Diff line change 1+ import { printExpected } from 'jest-matcher-utils' ;
12import { expect } from 'tdd-buffet/expect/jest' ;
23import { describe , it } from 'tdd-buffet/suite/node' ;
34import { instance } from '../src' ;
45import { ApplyProp } from '../src/expectation' ;
56import { mock } from '../src/mock' ;
7+ import { expectAnsilessEqual } from './ansiless' ;
68import { SpyRepository } from './expectation-repository' ;
79
810describe ( 'instance' , ( ) => {
@@ -29,4 +31,11 @@ describe('instance', () => {
2931 expect ( instance ( foo ) . bar ) . toEqual ( 42 ) ;
3032 expect ( repo . getCalledWith ) . toEqual ( [ 'bar' ] ) ;
3133 } ) ;
34+
35+ it ( 'should pretty print' , ( ) => {
36+ expectAnsilessEqual (
37+ printExpected ( instance ( mock < any > ( ) ) ) ,
38+ '[Function mock]'
39+ ) ;
40+ } ) ;
3241} ) ;
Original file line number Diff line number Diff line change @@ -265,9 +265,9 @@ export const repoContractTests: ExpectationRepositoryContract = {
265265 {
266266 name : 'should return values for toString and friends' ,
267267 test : ( repo ) => ( ) => {
268- expect ( repo . get ( 'toString' ) ( ) ) . not . toHaveLength ( 0 ) ;
269- expect ( repo . get ( '@@toStringTag' ) ) . not . toHaveLength ( 0 ) ;
270- expect ( repo . get ( Symbol . toStringTag ) ) . not . toHaveLength ( 0 ) ;
268+ expect ( repo . get ( 'toString' ) ( ) ) . toBeTruthy ( ) ;
269+ expect ( repo . get ( '@@toStringTag' ) ) . toBeTruthy ( ) ;
270+ expect ( repo . get ( Symbol . toStringTag ) ) . toBeTruthy ( ) ;
271271 } ,
272272 } ,
273273 {
You can’t perform that action at this time.
0 commit comments