3

私は得ています

Uncaught TypeError: Cannot call method 'extractId' of undefined 

QUnit との統合テストの実行中。

失敗したテスト:

module "Points",
  setup: ->
    App.reset()
    Ember.run App, App.advanceReadiness

test "Index", ->
  visit("/points").then ->
    ok(exists(".title:contains('POINTS')"), "Retrieved title of points section")
    App.Point.find().then (points) ->
      equal(find(".listContainer li").length, points.get('length') , "Retrieved correct number of points")

このテストを単独で実行するとうまくいきますが、モジュール内でこのテストを実行すると、上記のエラーがスローされます。adapterForType(App.Point)未定義の値を返すようです。

テストの更新

test "Index", ->
  result = App.Point.find()
  visit("/points").then ->
    ok(exists(".title:contains('POINTS')"), "Retrieved title of points section")
    result.then (points) ->
      equal(find(".listContainer li").length, points.get('length') , "Retrieved correct number of points")

エラーを軽減します。

adapterForType正しいテストで返される値は次のとおりです。

Ember.inspect(this.adapterForType(App.Point))
"{serializer: <DS.FixtureSerializer:ember455>, _attributesMap: [object Object], _configurationsMap: [object Object], _outstandingOperations: [object Object], _dependencies: [object Object]}"

この動作に関連する提案はありますか?

4

1 に答える 1