Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to make it run the constructor? #436

Open
donnyroufs opened this issue Mar 16, 2023 · 0 comments
Open

Is there a way to make it run the constructor? #436

donnyroufs opened this issue Mar 16, 2023 · 0 comments

Comments

@donnyroufs
Copy link

Hey 馃憢

I would like to share a test suite so that I do not need to create the same one with different dependencies, but it does not seem to be 'possible' since it does not run the constructor.

The base class that contains the tests
image

Using inheritance:

export class CreateTaskShould extends BaseCreateTask {
  public constructor() {
    const fakeRepo = new FakeTaskRepository()
    const db = new TestDatabaseClient(fakeRepo)
    super(db, fakeRepo)
  }
}

results in dependencies being undefined because the constructor is never ran. Now another solution would have been to make "BaseCreateTask" abstract but then the decorators won't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant