Feature/test suite (#169)
* Adding first run of the test environment * small tweaks * Fixing tests suite to ohif-viewer * Improving documentation and fixing versions * Removing commented lines
This commit is contained in:
1 parent
43a7e8151a
commit
bf68707ff2
7 files changed
+325
No files matched your search
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"include": [
|
||||
"server/*.js",
|
||||
"client/*.js",
|
||||
"both/*.js"
|
||||
],
|
||||
"exclude": {
|
||||
"general": [],
|
||||
"server": [
|
||||
"**/node_modules/**/*.json",
|
||||
"**/.?*/**",
|
||||
"**/packages/!(local-test_?*.js)",
|
||||
"**/+([^:]):+([^:])/**",
|
||||
"**/@(test|tests|spec|specs)/**",
|
||||
"**/?(*.)test?(s).?*",
|
||||
"**/?(*.)spec?(s).?*",
|
||||
"**/?(*.)app-test?(s).?*",
|
||||
"**/?(*.)app-spec?(s).?*"
|
||||
],
|
||||
"client": [
|
||||
"**/client/stylesheets/**",
|
||||
"**/.npm/package/node_modules/**",
|
||||
"**/web.browser/packages/**",
|
||||
"**/.?*/**",
|
||||
"**/packages/!(local-test_?*.js)",
|
||||
"**/+([^:]):+([^:])/**",
|
||||
"**/@(test|tests|spec|specs)/**",
|
||||
"**/?(*.)test?(s).?*",
|
||||
"**/?(*.)spec?(s).?*",
|
||||
"**/?(*.)app-test?(s).?*",
|
||||
"**/?(*.)app-spec?(s).?*"
|
||||
]
|
||||
},
|
||||
"remapFormat": [
|
||||
"html",
|
||||
"cobertura",
|
||||
"clover",
|
||||
"json",
|
||||
"json-summary",
|
||||
"lcovonly",
|
||||
"teamcity",
|
||||
"text",
|
||||
"text-summary"
|
||||
],
|
||||
"output": "./.coverage"
|
||||
}
|
||||
@@ -212,3 +212,51 @@ Package.onUse(function(api) {
|
||||
api.mainModule('main.js', 'client');
|
||||
|
||||
});
|
||||
|
||||
Package.onTest(function(api) {
|
||||
const both = ['client', 'server'];
|
||||
|
||||
api.versionsFrom('1.4');
|
||||
|
||||
/*
|
||||
* Really important dependencies to the project
|
||||
*/
|
||||
api.use(['ecmascript',
|
||||
'standard-app-packages',
|
||||
'http',
|
||||
'jquery',
|
||||
'mongo',
|
||||
'momentjs:moment',
|
||||
'validatejs',
|
||||
'u2622:persistent-session'
|
||||
], both);
|
||||
|
||||
// OHIF dependencies
|
||||
api.use([
|
||||
'lookback:logger',
|
||||
'aldeed:simple-schema@1.5.3',
|
||||
'ohif:design',
|
||||
'ohif:core',
|
||||
'ohif:hotkeys',
|
||||
'ohif:log'
|
||||
], both);
|
||||
|
||||
/*
|
||||
* Our custom packages
|
||||
*/
|
||||
api.use('ohif:viewerbase', both);
|
||||
|
||||
/*
|
||||
* Tests framework components
|
||||
*/
|
||||
api.use('cultofcoders:mocha');
|
||||
api.use('practicalmeteor:sinon');
|
||||
api.use('practicalmeteor:chai');
|
||||
api.use('lmieulet:meteor-coverage@1.1.4');
|
||||
api.use('xolvio:template-isolator');
|
||||
|
||||
/*
|
||||
* Adding all our tests files
|
||||
*/
|
||||
api.addFiles('./tests/client/components/viewer/gridLayout/gridLayout.tests.js', 'client');
|
||||
});
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import '../../../../../client/components/viewer/gridLayout/gridLayout.html';
|
||||
import '../../../../../client/components/viewer/gridLayout/gridLayout.js';
|
||||
import { Session } from 'meteor/session';
|
||||
import { sinon } from 'meteor/practicalmeteor:sinon';
|
||||
chai.should();
|
||||
|
||||
describe('GridLayout', function() {
|
||||
describe('Helpers', function() {
|
||||
before(function() {
|
||||
Template.instance = function() {
|
||||
return {
|
||||
data: {
|
||||
rows: 2,
|
||||
columns: 2,
|
||||
viewportData: []
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('should get the height percentage of each viewport', function() {
|
||||
const percentage = Template.gridLayout.__helpers[' height']();
|
||||
|
||||
percentage.should.be.eq(50);
|
||||
});
|
||||
|
||||
it('should get the width percentage of each viewport', function() {
|
||||
const percentage = Template.gridLayout.__helpers[' height']();
|
||||
|
||||
percentage.should.be.eq(50);
|
||||
});
|
||||
})
|
||||
|
||||
after(function() {
|
||||
Meteor.sendCoverage(function() { });
|
||||
});
|
||||
|
||||
// describe('Testing getClass() Helper', function () {
|
||||
// it('should return priorDropdown', function () {
|
||||
// Session.set('isPrior', true);
|
||||
// Template.priorDropdown.__helpers.get('getClass')()
|
||||
// .should.equal('priorDropdown');
|
||||
// });
|
||||
|
||||
// it('should return empty string', function () {
|
||||
// Session.set('isPrior', false);
|
||||
// Template.priorDropdown.__helpers.get('getClass')()
|
||||
// .should.equal('');
|
||||
// });
|
||||
// });
|
||||
|
||||
// describe('Testing dropdown change event', function () {
|
||||
|
||||
// let openPriorStudyWindowStub;
|
||||
// let test;
|
||||
|
||||
// before(function () {
|
||||
|
||||
// Template.instance = function () { return { openPriorStudyWindow: sinon.spy() } };
|
||||
|
||||
// $.fn.select2 = function () {
|
||||
// return [{
|
||||
// selectedIndex: 0,
|
||||
// options: [{
|
||||
// text: 'Attrial Septum'
|
||||
// }]
|
||||
// }]
|
||||
// };
|
||||
// });
|
||||
|
||||
// it('should return priorDropdown', function () {
|
||||
// Template.priorDropdown.fireEvent('change #studySelect');
|
||||
// // TODO: spy is not working
|
||||
// });
|
||||
// });
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { chai } from 'meteor/practicalmeteor:chai';
|
||||
import ReportService from 'meteor/lmieulet:meteor-coverage'
|
||||
|
||||
chai.should();
|
||||
|
||||
describe('Exporting coverage report', function() {
|
||||
it('Generating coverage report', function() { });
|
||||
|
||||
after(function() {
|
||||
const reportService = new ReportService.ReportService();
|
||||
const mockRes = { end: () => { }, writeHead: () => { } };
|
||||
|
||||
// The possible reports
|
||||
// Check https://github.com/serut/meteor-coverage
|
||||
reportService.generateReport(mockRes, 'text-summary', {});
|
||||
reportService.generateReport(mockRes, 'html', {});
|
||||
reportService.generateReport(mockRes, 'json-summary', {});
|
||||
reportService.generateReport(mockRes, 'lcovonly', {});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user