Я пытаюсь использовать ember-cli-mirage в своих тестах, но сталкиваюсь с проблемами. Я использую ember и ember-data 2.1.0, так что это может иметь какое-то отношение к этому.
Я могу использовать мираж в разработке просто отлично. Я определил фабрики, маршруты, сценарии и т. д. без проблем.
Проблема в том, что я пытаюсь создать модели в тестах. Тест ниже выдает ошибку:
import Ember from 'ember';
import { module, test } from 'qunit';
import startApp from 'frontend/tests/helpers/start-app';
let application;
module('Acceptance | Customer', {
beforeEach() {
application = startApp();
},
afterEach() {
Ember.run(application, 'destroy');
}
});
test('viewing customers', function(assert) {
server.createList('customer', 2);
visit('/admin/customers');
andThen(() => assert.equal(find('#customers-table tbody tr').length, 2));
});
Это приводит к:
not ok 1 PhantomJS 1.9 - Acceptance | Customer: viewing customers
---
actual: >
null
message: >
Died on test #1 at http://localhost:7357/assets/test-support.js:3124
at http://localhost:7357/assets/frontend.js:2434
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:6846: 'undefined' is not a function (evaluating 'newCollection[method].bind(newCollection)')
Log: |
...
Должен ли я где-то загружать мираж?