GET リクエストが正しい量の項目を返すかどうかを確認する単体テストを作成しようとしていますが、これを行うためにモック データを使用しています。
私のテストは次のようになります。
test.js
describe('Customer Controller', function () {
    var controller;
    var customers = mockData.getMockCustomers(); // fake customers (5 customers)
    beforeEach(function() {
      bard.appModule('app');
      bard.inject('$controller', '$q', '$rootScope');
      var cs = {
        getCustomers: function() {
          return $q.when(customers);
        }
      };
      controller = $controller('customersCtrl', {
        CustomerService: cs
      });
    });
    it('should return 5 customers', function() {
      $rootScope.$apply();
      expect(controller.customers).to.have.length(5);
    });
});
テストを実行すると、次のエラーが発生し続けます。
TypeError: 未定義のプロパティ '長さ' を読み取ることができません
何らかの理由でcontroller.customers戻ってくるようです。undefinedデータを正しくモックしていますか?
私はこれに非常に慣れていないので、何が間違っているのかわかりません。そのような問題をデバッグする方法さえ知りません。
どんな助けでも大歓迎です。前もって感謝します!
アップデート
私のコントローラーは次のようになります。
function customersCtrl(dataservice) {
  var vm = this;
  vm.customers = [];
  fetchCustomers();
  function fetchCustomers() {
    return dataservice.getCustomers()
    .then(function(data) {
      vm.customers = data.data;
      return vm.customers ;
    });
  }
}
更新 2
テストに console.log を入れたところ、customers 変数が空のように見える 5 つのオブジェクトを返しています。おそらくこれが問題ですか?
