Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Add ability to run whenCalledRemotely only once #43

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

Conversation

jrschumacher
Copy link
Contributor

No description provided.

@slnode
Copy link

slnode commented Jan 29, 2015

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

@jrschumacher
Copy link
Contributor Author

@ritch I've rebased to the current master. Any chance we could discuss this, this week?

@ritch
Copy link
Contributor

ritch commented Feb 5, 2015

I'm not against this... @bajtos any thoughts?

@bajtos
Copy link
Contributor

bajtos commented Feb 5, 2015

I am not a big fan of this API sugar, I am not sure if it is a good idea to keep extending it.

Setting that aside, I suppose it's ok to let the user to decide whether the request should be issued once per suite or once per each test. I don't like the magic detection of $once in the callback, can we provide two different methods?

Option A - more verbose:

  • lt.describe.whenCalledRemotelyBeforeEachTest
  • lt.describe.whenCalledRemotelyBeforeSuite

Option B - matching beforeEach/before hooks provided by mocha:

  • lt.describe.whenCalledRemotelyBeforeEach
  • lt.describe.whenCalledRemotelyBefore (

@jrschumacher
Copy link
Contributor Author

@bajtos I'd be happy to do that, this was purely a hack to get whenCalledRemotely fixed quickly.

Something I found to be an issue is that we will need to add before and beforeEach options throughout. In Mocha before is run first then beforeEach. So specifically lt.beforeEach.withApp() will always be run after lt.describe.whenCalledRemotelyBefore which throws an expected error.

On another note I like Option A the best. Since loopback-testing is essentially a wrapper it seems more friendly syntax in helping to explain what it actually does.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

5 participants