Acceptance Test Session Store Ember Simple Auth


#1

So I am trying to write an acceptance test for my ember app. I use Ember Simple Auth and in the route I have the following code

let session = getOwner(this).lookup('session:main'),
      sessionStore = this.get('session.store');

sessionStore.updateKey("my-app");

When I am running the app it works just fine. Now when I write the following test I get errors that updateKey is not a function

import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { currentSession } from 'ember-simple-auth/test-support';

module('Acceptance | service menu', function(hooks) {
  setupApplicationTest(hooks);
  setupMirage(hooks);

  test('visiting /service-menu', async function(assert) {
    this.server.createList('service-category', 5);
    this.server.create('location');

    currentSession(this.application);

    await visit('/location/testLocation/service-menu');

    await this.pauseTest();

    assert.equal(currentURL(), '/location/testLocation/service-menu');
  });
});

What am I missing? I do not want the user to be logged in.


#2

I started researching a reply to this but then saw there is already an answer from the ESA maintainers.


#3

Yes, thanks @ef4 it seems that test use in memory. I am taking from how he closed it that any custom code on top like the updateKey function we have will not be visible in test.