0

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 (when I try to do a TestHelper.handleCreate('task-local'); I get an error adapter.buildURL is not a function).

mahi-man
  • 4,326
  • 2
  • 25
  • 36
  • Did you learn any more about this? What did your afterEach hooks look like? – nruth Mar 22 '16 at 03:31
  • No I didn't sorry. I ended up having a lot of issues with Ember data that were just taking up too much time. I ended up switching to AngularJS. – mahi-man Mar 22 '16 at 07:36

0 Answers0