【问题标题】:Integrating Ember_simple_auth with acceptance tests (using Mirage)将 Ember_simple_auth 与验收测试集成(使用 Mirage)
【发布时间】:2016-03-03 20:43:15
【问题描述】:

我创建了一个使用 OMDb API(开放电影数据库)的基本测试应用,使用 some help from SO posters 一切正常。

我将 ember-simple-auth(版本 1.0.0)添加到项目中,并让开发方面的工作顺利进行。基本上有一个简单的登录屏幕可以进入主应用程序。它按预期工作。

但是,我的两个基本验收测试现在不起作用。将 ember-simple-auth 组件和功能添加到应用程序后,我添加到验收测试文件中:

import { currentSession, authenticateSession, invalidateSession } from 'movie-example/tests/helpers/ember-simple-auth';

在测试本身中,我补充说:

authenticateSession();

现在测试失败了,说:

Cannot read property '__container__' of undefined

此外,如果我注释掉导入行和 authenticateSession() 调用,测试仍然失败,但因为 DOM 显然是完全空的。

如果有人好奇/愿意,整个东西都可以在回购中获得:git@github.com:bdrsgg/ember-movie-example.git (branch = feature/ember-simple-auth)

我认为我弄错了一些配置问题,或者类似的问题。感谢任何人可以提供的任何帮助。

编辑添加:

这个问题似乎主要集中在身份验证上。例如,如果我从路由中删除 AuthenticatedRouteMixin 调用,并省略 authenticateSession() 调用,则测试通过。

【问题讨论】:

    标签: ember.js ember-simple-auth ember-cli-mirage


    【解决方案1】:

    原来我只是没有正确声明早期的应用程序变量。长话短说,当我将 authenticateSession() 更改为 authenticateSession(this.application) 时,一切正常。

    【讨论】:

      猜你喜欢
      • 2015-10-25
      • 1970-01-01
      • 1970-01-01
      • 2011-05-06
      • 1970-01-01
      • 1970-01-01
      • 2011-12-02
      • 2017-10-23
      • 2018-10-31
      相关资源
      最近更新 更多