-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathmethods.unit.tests.js
More file actions
50 lines (40 loc) · 1.26 KB
/
methods.unit.tests.js
File metadata and controls
50 lines (40 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { HTTP } from 'meteor/http';
import chai from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
import Meteor from 'meteor/lmieulet:meteor-coverage';
const {expect, assert} = chai;
chai.use(sinonChai);
describe('meteor-coverage', function (done) {
let sandbox;
beforeEach(function () {
sandbox = sinon.createSandbox();
});
afterEach(function () {
sandbox.restore();
});
it('should be defined', function () {
assert.isDefined(Meteor.exportCoverage);
assert.isDefined(Meteor.getCoverageObject);
assert.isDefined(Meteor.importCoverage);
assert.isDefined(Meteor.sendCoverage);
});
it('export coverage', function () {
const callback = sandbox.spy();
sandbox.stub(JSON, 'parse').returns({type: 'success'});
sandbox.stub(HTTP, 'call').callsFake(function(verb, url, config, c) {
c();
});
Meteor.exportCoverage('test', callback);
expect(callback).to.have.been.called;
});
it('import coverage', function () {
const callback = sandbox.spy();
sandbox.stub(JSON, 'parse').returns({type: 'success'});
sandbox.stub(HTTP, 'call').callsFake(function(verb, url, config, c) {
c();
});
Meteor.importCoverage(callback);
expect(callback).to.have.been.called;
});
});