Strategies for managing Pretender mocks

I’m looking for a manageable solution to Acceptance testing with Pretender.js.

Currently the process involves copying some JSON from our API server and putting it into our integration tests. This doesn’t scale well at all. Any time the data format changes… we have to go into the tests and update!

Does anybody have a comprehensive testing setup that can still leverage Pretender mocks but can be updated more readily (that doesn’t require an extensive manual step to function?)

1 Like

Have you checked out ember-cli-mirage?

2 Likes

@timothythehuman It looks quite promising and I will consider it for future projects.

It’s been quite a while but I have some news to report on this subject.

I successfully integrated ember-cli-mirage into a project in the sense that I replicated my http-mock and Pretender setups to now both run through ember-cli-mirage. That’s actually pretty great. It lets me use fresh data in console-based testing.

It was a slog rewriting the rules from both the latter systems into the former, but now I have only one set of rules to update and it feels good man.

The other thing is though, I am still using json dumps from my API rather than any of the on-the-fly model creation features. This is something I will pursue in future.

However, at present there are a couple of roadblocks to merging into our master branch:

  1. The Faker/faker issue related to case sensitivity of an npm dependency. (it breaks our linux CI build)
  2. The need to refactor both ember-cli-mirage and our own project to use the same ember-lodash

I will continue to update this with some other information.