dimanche 24 mai 2015

Can't find variable: invalidateSession using ember-cli-simple-auth-testing

I'm using ember-cli-simple-auth and testing with ember-cli-simple-auth-testing. I've followed the README to install the testing library.

tests/helpers/start-app.js contains:

import Ember from 'ember';
import Application from '../../app';
import Router from '../../router';
import config from '../../config/environment';

import 'simple-auth-testing/test-helpers';

export default function startApp(attrs) {
  var application;

  var attributes = Ember.merge({}, config.APP);
  attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;

  Ember.run(function() {
    application = Application.create(attributes);
    application.setupForTesting();
    application.injectTestHelpers();
  });

  return application;
}

config/environment.js contains:

...
if (environment === 'test') {
  // Testem prefers this...
  ENV.baseURL = '/';
  ENV.locationType = 'none';

  // keep test console output quieter
  ENV.APP.LOG_ACTIVE_GENERATION = false;
  ENV.APP.LOG_VIEW_LOOKUPS = false;

  ENV.APP.rootElement = '#ember-testing';

  ENV['simple-auth'] = {
    store: 'simple-auth-session-store:ephemeral'
  }
}
...

When I call invalidateSession() in my test, I get the following error:

Acceptance | items: the route /items is inaccessible when the session is not authenticated
✘ Died on test #1     at http://localhost:7357/assets/test-support.js:2688
    at http://localhost:7357/assets/wishlist.js:2055
    at http://localhost:7357/assets/vendor.js:150
    at tryFinally (http://localhost:7357/assets/vendor.js:30)
    at http://localhost:7357/assets/vendor.js:156
    at http://localhost:7357/assets/test-loader.js:29
    at http://localhost:7357/assets/test-loader.js:21
    at http://localhost:7357/assets/test-loader.js:40
    at http://localhost:7357/assets/test-support.js:5460: Can't find variable: invalidateSession

I must have done something wrong. What is it?




Aucun commentaire:

Enregistrer un commentaire