をテストするには? 私は受け入れテストを使用してみましたが、私は成功しませんでした:どのように私は簡単にするために、以下のように見える私のルータをテストしたいと思いますEmber.Router
import Ember from 'ember';
import { test } from 'qunit';
import moduleForAcceptance from 'transformed-admin/tests/helpers/module-for-acceptance';
import startApp from 'transformed-admin/tests/helpers/start-app';
moduleForAcceptance('Acceptance | configuration', {
beforeEach: function() {
this.application = startApp();
},
afterEach: function() {
Ember.run(this.application, 'destroy');
}
});
test('should map routes correctly', function(assert) {
visit('/');
const app = this.application;
andThen(function() {
app.Router.detect("profile"); // false
app.Router.detect("Profile"); // false
const a = app.Router.extend({});
a.detect("profile"); // false
a.detect("Profile"); // false
});
});
ここでのベストプラクティスは何ですか? Router.map()
は全くテストしていますか?または、Router.map()
が正しく書かれていることを保証するために具体的なルートのテストに頼っていますか?
[currentUrl](http://emberjs.com/api/classes/Ember.Test.html#method_currentURL)と[currentPath](http://emberjs.com/api/classes/)を確認する受け入れテストEmber.Test.html#method_currentPath)は十分以上であるべきです –
ありがとうございます@Kitler – Pavol