だから、私は Ember コントローラーを QUnit テストしようとしています。問題は、コントローラーが複数のコントローラーを含む coffeeScript ファイル内にあることです。
今、残り火のテストガイドは言う、コントローラーをテストするには、次のように「moduleFor」ヘルパーを使用する必要があります。
moduleFor(fullName [, description [, callbacks]])
私の場合、フルネームは "CustomersIndexController" ですが、それ自体が複数のコントローラーを含む "customers_controller.coffee" に含まれているため、テストで問題が発生しました。
オンラインで無限に掘り下げた後、リゾルバーは「デフォルトのmyModelのエクスポート」が提供する名前ではなく、ファイル名のみを気にすることがわかりました(間違っている場合は修正してください)
より明確にするために、ここに私の「customers_controller.coffee」があります:
`export { CustomersIndexController, CustomersItemController }`
CustomersIndexController = Ember.ArrayController.extend
#Code goes here ......
CustomerItemController = Ember.ObjectController.extend
#Code goes here .....
そして、ここにcustomers-controller-test.coffee
ファイルがあります:
`import { test, moduleFor } from 'ember-qunit';`
moduleFor("controller:customers-index-controller", 'C Controller')
test "it's an App.Controller", -> ok(@subject())
私は自分の脳が生み出すことができるすべてのアイデアを試しました...運がなければ(コントローラー名をキャメルケースからダッシュ化、絶対パスに変更し、customers_controller.coffeeをインポートしようとさえしました)、しかし私は得続けます:
Setup failed on it's a App.Controller: Attempting to register an unknown factory: `controller:customers-index-controller`
ヘルプ/アドバイス/リンクは大歓迎です。