@@ -8,8 +8,8 @@ import { AreProxiesDisabledKey } from "../Substitute";
88export class InitialState implements ContextState {
99 private recordedGetPropertyStates : Map < PropertyKey , GetPropertyState > ;
1010 private recordedSetPropertyStates : SetPropertyState [ ] ;
11-
12- private _expectedCount : number | undefined | null ;
11+
12+ private _expectedCount : number | undefined | null ;
1313 private _areProxiesDisabled : boolean ;
1414
1515 public get expectedCount ( ) {
@@ -47,28 +47,28 @@ export class InitialState implements ContextState {
4747 }
4848
4949 assertCallCountMatchesExpectations (
50- calls : Call [ ] , // list of arguments
51- callCount : number ,
52- type : Type , // method or property
53- property : PropertyKey ,
54- args : any [ ]
50+ calls : Call [ ] , // list of arguments
51+ callCount : number ,
52+ type : Type , // method or property
53+ property : PropertyKey ,
54+ args : any [ ]
5555 ) {
5656 const expectedCount = this . _expectedCount ;
5757
5858 this . clearExpectations ( ) ;
59- if ( this . doesCallCountMatchExpectations ( expectedCount , callCount ) )
59+ if ( this . doesCallCountMatchExpectations ( expectedCount , callCount ) )
6060 return ;
61-
61+
6262 throw new Error (
63- 'Expected ' + ( expectedCount === null ? '1 or more' : expectedCount ) +
64- ' call' + ( expectedCount === 1 ? '' : 's' ) + ' to the ' + type + ' ' + property . toString ( ) +
65- ' with ' + stringifyArguments ( args ) + ', but received ' + ( callCount === 0 ? 'none' : callCount ) +
66- ' of such call' + ( callCount === 1 ? '' : 's' ) +
63+ 'Expected ' + ( expectedCount === null ? '1 or more' : expectedCount ) +
64+ ' call' + ( expectedCount === 1 ? '' : 's' ) + ' to the ' + type + ' ' + property . toString ( ) +
65+ ' with ' + stringifyArguments ( args ) + ', but received ' + ( callCount === 0 ? 'none' : callCount ) +
66+ ' of such call' + ( callCount === 1 ? '' : 's' ) +
6767 '.\nAll calls received to ' + type + ' ' + property . toString ( ) + ':' + stringifyCalls ( calls )
6868 ) ;
6969 }
7070
71- private doesCallCountMatchExpectations ( expectedCount : number | undefined | null , actualCount : number ) {
71+ private doesCallCountMatchExpectations ( expectedCount : number | undefined | null , actualCount : number ) {
7272 if ( expectedCount === void 0 )
7373 return true ;
7474
@@ -82,7 +82,7 @@ export class InitialState implements ContextState {
8282 }
8383
8484 set ( context : Context , property : PropertyKey , value : any ) {
85- if ( property === AreProxiesDisabledKey ) {
85+ if ( property === AreProxiesDisabledKey ) {
8686 this . _areProxiesDisabled = value ;
8787 return ;
8888 }
@@ -102,19 +102,20 @@ export class InitialState implements ContextState {
102102
103103 get ( context : Context , property : PropertyKey ) {
104104 if ( typeof property === 'symbol' ) {
105- if ( property === AreProxiesDisabledKey )
105+ if ( property === AreProxiesDisabledKey )
106106 return this . _areProxiesDisabled ;
107107
108108 if ( property === Symbol . toPrimitive )
109109 return ( ) => '{SubstituteJS fake}' ;
110110
111+ if ( property . toString ( ) === 'Symbol(util.inspect.custom)' )
112+ return ( ) => '{SubstituteJS fake}' ;
113+
111114 if ( property === Symbol . iterator )
112115 return void 0 ;
113116
114117 if ( property === Symbol . toStringTag )
115118 return 'Substitute' ;
116- if ( property . toString ( ) === 'Symbol(util.inspect.custom)' )
117- return void 0 ;
118119 }
119120
120121 if ( property === 'valueOf' )
0 commit comments