mock set to null when interface and namespace have the same name
See original GitHub issueSubject of the issue
When there is a namespace and an interface with the same name, with the namespace declared first, mocking that interface returns null.
Your environment
- ts-auto-mock version: 3.2.2
- typescript version: 4.3.2
- node version: 14.3.0
- npm version: 7.6.0
- list any other dependencies that you think are relevant
- though it is probably irrelevant to the example, I am using jest-ts-auto-mock v2.0.0
Steps to reproduce
import {createMock} from 'ts-auto-mock'
namespace B {}
interface B {
b: string
}
console.log(createMock<B>())
Expected behavior
Should log {b: ""}
Actual behavior
Actually logs null
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (2 by maintainers)
Top Results From Across the Web
Mocked method returns null - Stack Overflow
The Mock would return a default value (e.g. null) in case a call is made for which an expectation has not been set....
Read more >JUnit 5 User Guide
Used to configure the test instance lifecycle for the annotated test class. Such annotations are inherited. @DisplayName. Declares a custom ...
Read more >Testing Reference | GoogleTest
Tests in different test suites can have the same individual name. The statements within the test body can be any code under test....
Read more >Using xUnit to Test your C# Code - Auth0
How to create unit tests and integration tests with xUnit for your C# applications.
Read more >Why do I get an error "value cannot be null (Parameter 'type ...
namespace CoreMVC5Sample.Models; {; public class Locations; {; public Locations(); {; Name = "default";; }; public string Name { get; set; } ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
PR open to fix it #793 now waiting for @uittorio to review it, in one day max it should go in 😄
I confirmed the bug, I’ll take care of it!
The last thing you said is normal, for the transformer
B
is an empty object so that generates an empty object (plus a marker for mocks to work that won’t impact any runtime execution)