Skip to content

Ensure boolean value for isNewInstance#532

Closed
rmg wants to merge 1 commit into
masterfrom
strict-tests
Closed

Ensure boolean value for isNewInstance#532
rmg wants to merge 1 commit into
masterfrom
strict-tests

Conversation

@rmg

@rmg rmg commented Mar 24, 2015

Copy link
Copy Markdown
Contributor

The tests are testing for true/false, not truthy/falsy, so the value
should be coerced to match.

@bajtos I found this while tinkering with loopbackio/loopback-connector-mongodb#116

The tests are testing for true/false, not truthy/falsy, so the value
should be coerced to match.
@bajtos

bajtos commented Mar 24, 2015

Copy link
Copy Markdown
Member

There are three valid values: true, false and undefined meaning either it's not possible to tell or that the connector does not provide the value yet. Which is the case of the mongodb connector I believe?

/cc @superkhau

@bajtos

bajtos commented Mar 24, 2015

Copy link
Copy Markdown
Member

@rmg here is the algorithm I need to preserve:

  • result or result.isNewInstance is not defined => ctx.isNewInstance = undefined
  • result.isNewInstance is truthy => ctx.isNewInstance = true
  • result.isNewInstance is false => ctx.isNewInstance = false

@rmg

rmg commented Mar 24, 2015

Copy link
Copy Markdown
Contributor Author

I made this change to match the test suite. I guess it's the test suite that needs updating instead.

@rmg rmg closed this Mar 24, 2015
@altsang altsang removed the #review label Mar 24, 2015
@rmg rmg removed the #review label Mar 24, 2015
@bajtos
bajtos deleted the strict-tests branch April 7, 2016 15:23
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.

3 participants