File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ export function object<T>(constructor: { new (...args: any[]): T }): DoubledObje
20
20
// When passed array of props
21
21
export function object < Key extends string > ( props : Key [ ] ) : DoubledObjectWithKey < Key > ;
22
22
23
+ // When passed class or constuctor function name as string value
24
+ export function object < T > ( object : string ) : DoubledObject < T > ;
25
+
23
26
// When passed general object
24
27
export function object < T > ( object : T ) : DoubledObject < T > ;
25
28
Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ td.when(dog.bark()).thenReturn("bark!");
17
17
const bird = td . object ( { fly : function ( ) { } } ) ;
18
18
td . when ( bird . fly ( ) ) . thenReturn ( "fly!" ) ;
19
19
20
+ class Bear { constructor ( ) { } ; sleep ( ) { } ; } ;
21
+ const bear = td . object < Bear > ( "Bear" ) ;
22
+ td . when ( bear . sleep ( ) ) . thenReturn ( "zzz" ) ;
23
+
20
24
td . replace ( { } , "prop" ) ;
21
25
td . replace ( { } , "prop" , 42 ) ;
22
26
td . replace ( "../../.." ) ;
You can’t perform that action at this time.
0 commit comments