当我尝试使用Jasmine和一个Karma(在Node.js中)跑步者测试Breeze时,我似乎无法达到起点。 VS 2013. Karma在自己的服务器上运行,所以我不得不允许CORS。无论如何,下面的Jasmine测试都没有运行:
describe('Able to retrieve a single account record...', function() {
var manager, acc, asyncCallComplete;
asyncCallComplete = false;
manager = new breeze.EntityManager({
serviceName: 'http://localhost:35092/api/BreezeApi'
});
// Load filtered accounts
runs(function() {
breeze.EntityQuery.from('Accounts')
.select('id, accountName')
.where('id', '==', 2)
.using(manager).execute()
.then(function() {
acc = data.result;
asyncCallComplete = true;
}, function (error) {
asyncCallComplete = true;
throw error;
});
waitsFor(function () {
return asyncCallComplete != false;
});
expect(acc.accountName).toBe('Account Two');
});
});
很简单,但它不起作用。查询既不成功也不失败,只是超时。有趣的是,浏览器显示检索到元数据,但没有后续调用来获取ACCOUNT记录(在这种情况下)。