我有一个MeteorJS
项目并做了一些测试。我写了Unit Test
,运行正常。然后,我后来为我的控制器添加了一些服务器集成测试。
现在我只有我的集成测试工作,我的Unit Test
报告上没有任何内容。即使我的测试文件从tests/server/integration
文件夹移动到test/server/unit
文件夹,应用程序也会运行而不会报告html-report或终端。任何提示?感谢。
//in tests/server/integration/store.controller.js
describe('StoreController', function(){
var storeController; //assign an instance of IronRouter to variable
//other code block and actual test comes here
});
//in tests/server/unit/store.collection.js
describe('StoreCollection', function(){
var Stores = null;
beforeEach(function(){
MeteorStubs.install();
//use mock for collection class
Stores = new Meteor.Collection('stores');
spyOn(Stores, 'find');
spyOn(Stores, 'aggregate');
});
afterEach(function(){
MeteorStubs.uninstall();
});
describe('StoreCollection.findActiveStores', function(){
it('should list all stores that are active', function(){
expect(StoreCollection.findActiveStores()).toBeDefined();
//test spy has been called or called with given parameters
expect(Stores.find).toHaveBeenCalled();
});
});
});