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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a method to provide an interface to supertest #18

Closed
1 task
rsaz opened this issue Apr 19, 2024 · 0 comments · Fixed by #20
Closed
1 task

Create a method to provide an interface to supertest #18

rsaz opened this issue Apr 19, 2024 · 0 comments · Fixed by #20
Assignees
Labels
enhancement New feature or request

Comments

@rsaz
Copy link
Member

rsaz commented Apr 19, 2024

Description

With the use of supertest with a non-trivial Express application setup using expresso-ts and InversifyJS for dependency injection, we face a challenge on how to integrate supertest for testing HTTP requests without directly exposing our Express application instance (this.app). We want to be cautious about maintaining good encapsulation and architecture practices.

One way to achieve this is by using a dedicated method in your AppExpress class that can be called during testing to get the app instance wrapped properly for testing purposes. This method will not expose this.app directly but instead can return a version of the application that is suitable for testing.

Requirements

  • Method creation with a wrapper around this.app (expressja app instance)
@rsaz rsaz converted this from a draft issue Apr 19, 2024
@rsaz rsaz self-assigned this Apr 19, 2024
@rsaz rsaz added the enhancement New feature or request label Apr 19, 2024
@rsaz rsaz moved this from Backlog to 💻 In Development in Adapter-Express (@expressots/adapter-express) Apr 19, 2024
@rsaz rsaz linked a pull request Apr 26, 2024 that will close this issue
12 tasks
@rsaz rsaz closed this as completed in #20 Apr 26, 2024
@github-project-automation github-project-automation bot moved this from 💻 In Development to ✅ Done in Adapter-Express (@expressots/adapter-express) Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

1 participant