vendredi 30 octobre 2015

Running Meteor Integration and Unit Test

I have a MeteorJS project and doing some test. I had written unit test which runs fine then later added some server integration test for my controllers. Now I have only my Integration test working and nothing comes up on my Unit Test report anymore. Even when my test files are moved from the tests/server/integration folder to test/server/unit folder, the application just runs with no report on the html-report or terminal. Any hints? Thanks.

//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(); 
    });
});
});

Aucun commentaire:

Enregistrer un commentaire