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

Add inRequestScope decorator inversify/InversifyJS/issues/678 #151

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

timtrinidad
Copy link

@timtrinidad timtrinidad commented Sep 25, 2018

Description

This adds inRequestScope support in fluentProvide.

Related Issue

inversify/InversifyJS/issues/678

How Has This Been Tested?

  • Updated tests that included inSingletonScope and inTransientScope to also include inRequestScope.
  • provide_in_syntax.test.ts refactored to reduce duplicate code.

Types of changes

  • Bug fix / Docs (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

}

public done(force?: boolean) {
return this._provideDoneSyntax.done(force);
}

private provideWhenOnSyntax(bindingWhenOnSyntax: interfaces.BindConstraint) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled this out to reduce duplicate code

expect(inTransientScopeExpectation.calledOnce).to.eql(true, "inTransientScope was not called exactly once");
expect(mockBind.calledWith("Ninja")).to.be.eql(true, "mock bind was not called");

["inSingletonScope", "inRequestScope", "inTransientScope"].forEach(scope => {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I combined the shared aspects of the code into one repeated test (the equivalent of a data provider).

The weirdest part was calling provideInSyntax.in[...]Scope(). I haven't called a string as a function in typescript so I ended up defining it as an object with string keys to get around the no-implicit-any compiler issue. I'm open to other approaches.

@timtrinidad
Copy link
Author

@remojansen Just wanted to ping to see if there was anything else needed for this PR

@timtrinidad
Copy link
Author

@dcavanagh Hey Dan! Would something like this go through you now?

@glanna
Copy link

glanna commented Feb 7, 2022

@remojansen @dcavanagh I'm also interested in this PR! Is there something that I can help?

@PodaruDragos
Copy link
Member

@jakehamtexas do you see any problems here, seems good to me at a first look.

@gustavolanna
Copy link

hi guys, can we merge this change in?

@adamxi
Copy link

adamxi commented Oct 10, 2023

Hmm inversify seems to be a dead project :(
I mean this PR is from 2018.. Just merge it already.

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

Successfully merging this pull request may close these issues.

5 participants