You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When moduleUnderTest.ts has a dependency to DependencyClass.ts with constructor and class-scope function classDoSomething() I am failing to mock DependencyClass for testing moduleUnderTest.ts.
Issue
moduleUnderTest.ts invokes new DependencyClass(options).classDoSomething(args)
const mockDependencyClass = td.replace('path/to/DependencyClass') is fine,
How do I mock the constructor?
How do I mock class-scope functions?
How do I use the td.when() pattern on class scope methods?
Environment
node -v output: v16.15.0
npm -v (or yarn --version) output: 8.5.5
npm ls testdouble (or yarn list testdouble) version: └── testdouble@3.16.3
Thanks for maintaining td - it's an awesome tool. The documentation is outstanding
The text was updated successfully, but these errors were encountered:
Description
When
moduleUnderTest.ts
has a dependency toDependencyClass.ts
with constructor and class-scope functionclassDoSomething()
I am failing to mockDependencyClass
for testingmoduleUnderTest.ts
.Issue
moduleUnderTest.ts
invokesnew DependencyClass(options).classDoSomething(args)
const mockDependencyClass = td.replace('path/to/DependencyClass')
is fine,td.when()
pattern on class scope methods?Environment
node -v
output:v16.15.0
npm -v
(oryarn --version
) output:8.5.5
npm ls testdouble
(oryarn list testdouble
) version:└── testdouble@3.16.3
Thanks for maintaining td - it's an awesome tool. The documentation is outstanding
The text was updated successfully, but these errors were encountered: