-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(genericNotProvided): make sure required generic will default to n…
…ull when are not provided (#180)
- Loading branch information
Showing
3 changed files
with
30 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { createMock } from 'ts-auto-mock'; | ||
|
||
describe('generic null', () => { | ||
it('should assign null value when not provided even if it was supposed to', () => { | ||
interface A<P> { | ||
prop: P; | ||
data: { | ||
a: string; | ||
}; | ||
} | ||
|
||
// @ts-ignore | ||
const mock: A = createMock<A>(); | ||
|
||
expect(mock.prop).toBeNull(); | ||
expect(mock.data.a).toBe(''); | ||
}); | ||
}); |