运行流星集成和单元测试

时间:2015-10-30 07:01:14

标签: unit-testing meteor

我有一个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(); 
    });
});
});

0 个答案:

没有答案