mardi 28 juillet 2015

Ember clear records between acceptance tests using Local Storage adapter

I am writing some acceptance tests for my Ember app and I don't know the best way to remove records created in localStorage between tests. I also don't want to lose any localStorage records I have created in my development environment.

I am currently setting a namespace in the LSAdapter using an environment variable so that development and test records are stored separately:

export default DS.LSAdapter.extend({
    namespace: ENV.taskLocalStorageKey
});

I can then remove the key in the afterEach hook in my tests: localStorage.removeItem(ENV.taskLocalStorageKey); but I am sure there is much better way to do this? I am also using ember data factory guy which I thought would do this for me automatically?




Aucun commentaire:

Enregistrer un commentaire