-
Notifications
You must be signed in to change notification settings - Fork 20
Change beforeEach to before #39
Comments
Here is a proof: 97c6445 |
@bajtos can we discuss the use of beforeEach vs before and finding some alternative like this? |
We might need both of them, as a beforeEach and as a Before so that we can easily build scenario based tests. But another solution would be to provide helper instead that can be used within a before or beforeEach. A bit like what is used in loopback/test/user.test.js |
@seriousben from your branch I created this: #42 Can you look over and give me some feedback. |
+1 for creating a helper method that can be used on its own. |
@bajtos can you describe what your idea of a separate helper would be? I'd be happy to implement it, but need some direction one what everyone is thinking. Also what if we create a chai plugin similar to chia-http or chia-change which sounds like what we are trying to do in some sense. |
Here is an usage example: beforeEach(helpers.cleanDatabase);
// or perhaps
before(given.emptyDatabase); Nice to have: beforeEach(given.noModelInstancesOf('User'));
I don't have a strong opinion on that. |
@bajtos I'm going to work on building the helpers this this week. We obviously want to be backwards compatible, but using the helpers seems like its going to require a lot of refactoring... and I really need to get If I go with the helper routine how would I handle |
@bajtos ping |
I don't want to block progress here, I guess #42 is the best we can achieve using the current suboptimal API, so no objections from me. |
@bajtos Thank you. |
Per this conversation: https://groups.google.com/forum/?pli=1#!topic/loopbackjs/1F4H8sDw4-A
All helpers are using beforeEach which at least for me is quite counterintuitive since it would call each remote calls for each it. I ended up copying the helpers and making them use before and after which makes it really easy to have some kind of testing scenario.
cc @seriousben
The text was updated successfully, but these errors were encountered: