Javascript 无法在茉莉花/业力测试中使用微风
当我尝试使用Jasmine和Karma(在Node.js中)runner来测试Breeze时,似乎我甚至无法到达起点。与2013年相比。Karma在它自己的服务器上运行,所以我必须允许COR。无论如何,以下Jasmine测试不会运行:Javascript 无法在茉莉花/业力测试中使用微风,javascript,unit-testing,jasmine,breeze,karma-runner,Javascript,Unit Testing,Jasmine,Breeze,Karma Runner,当我尝试使用Jasmine和Karma(在Node.js中)runner来测试Breeze时,似乎我甚至无法到达起点。与2013年相比。Karma在它自己的服务器上运行,所以我必须允许COR。无论如何,以下Jasmine测试不会运行: describe('Able to retrieve a single account record...', function() { var manager, acc, asyncCallComplete; asyncCallComplete
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');
});
});
很简单,但它不起作用。查询既不成功也不失败,只是超时。有趣的是,浏览器显示已检索元数据,但没有后续调用来获取帐户记录(在本例中)。在error函数中设置asyncCallComplete=true看起来是错误的!