What should I use instead of DS.FixtureAdapter

You must love the ember.js team ... I am getting this depreciation message: "DS.FixtureAdapter is deprecated and moved to an unsupported addon: https://github.com/emberjs/ember-data-fixture-adapter/tree/master " ... Guys, supporting this addon, we advise us to use a library similar to Pretender

. Has anyone done this? Is there a tutorial showing how to integrate this library to keep things still working?

+3


source to share


3 answers


If you are using it ember-cli

, it comes out http-mock

of the box, allowing you to quickly set up your fixtures in a more realistic test scenario. For example, for a model, Conversation

you can mock her by running the following prompt at the command line.

ember g http-mock conversations



This will close the endpoint located at server/mocks/conversations.js

which your real adapters will use to get data on startup ember serve

. You can modify this file to your liking to return any data you need for various CRUD operations.

+2


source


Server mocks:

Clientside mocks:



Clientside mocking has some benefits, such as portability, which makes it easier to use in a CI environment, but server-side mocking allows you to take advantage of middleware.

Note. I support Mirage. You can watch the screencast and review here .

+2


source


I like to use http-mocks with ember-cli. Also, I like to use raw JSON files as the payload for each endpoint here is a setup example https://github.com/pixelhandler/ember-fixturific/pull/1/files

+1


source







All Articles