import { createMock } from 'ts-auto-mock' ; describe ( 'for keyin' , ( ) => { describe ( 'with an union' , ( ) => { type Keys = 'z' | 'f' ; type MyType = { [ key in Keys ] : string ; } ; it ( 'should set all the keys as properties' , ( ) => { const properties = createMock < MyType > ( ) ; expect ( properties . z ) . toBe ( '' ) ; expect ( properties . f ) . toBe ( '' ) ; } ) ; } ) ; describe ( 'with an extend' , ( ) => { type Keys = 'a' & 'b' ; type MyType = { [ key in Keys ] : string ; } ; it ( 'should set an empty object' , ( ) => { const properties = createMock < MyType > ( ) ; expect ( properties ) . toEqual ( { } ) ; } ) ; } ) ; describe ( 'with a specific string' , ( ) => { it ( 'should set all the keys as properties' , ( ) => { type MyTypeDeclarative = { [ key in 's' ] : string ; } ; const properties = createMock < MyTypeDeclarative > ( ) ; expect ( properties . s ) . toBe ( '' ) ; } ) ; } ) ; } ) ;