File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,15 @@ import { stringifyCalls, stringifyArguments } from "./Utilities";
44
55const areProxiesDisabledKey = Symbol . for ( 'areProxiesDisabled' ) ;
66const handlerKey = Symbol . for ( 'handler' ) ;
7+ const isFake = Symbol . for ( 'isFake' ) ;
78
8- const internalSymbols = [ areProxiesDisabledKey , handlerKey ] ;
9+ const internalSymbols = [ areProxiesDisabledKey , handlerKey , isFake ] ;
910
1011export class Substitute {
12+ static isSubstitute < T > ( instance : T ) {
13+ return instance [ isFake ] ;
14+ }
15+
1116 static disableFor < T extends ObjectSubstitute < OmitProxyMethods < any > > > ( substitute : T ) : DisabledSubstituteObject < T > {
1217 const thisProxy = substitute as any ;
1318 const thisExposedProxy = thisProxy [ handlerKey ] ;
@@ -254,6 +259,7 @@ export class Substitute {
254259 thisProxy = new Proxy ( ( ) => { } , thisExposedProxy ) as any ;
255260
256261 thisProxy [ areProxiesDisabledKey ] = false ;
262+ thisProxy [ isFake ] = true ;
257263 thisProxy [ handlerKey ] = thisExposedProxy ;
258264
259265 return thisProxy ;
You can’t perform that action at this time.
0 commit comments