Skip to content

Commit 59df8f0

Browse files
agnivadewaldyrious
authored andcommitted
Fixing failing tests (#151)
* Update unit tests to match breaking changes in sinon. * Pin dependencies' versions to minor releases. Automatically keeping up to the latest versions may break code (and has done so before). When needed, we can always intentionally upgrade the packages.
1 parent 155952e commit 59df8f0

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@
6363
"unzip2": "~0.2.5"
6464
},
6565
"devDependencies": {
66-
"env-test": "*",
67-
"eslint": "*",
68-
"husky": "*",
69-
"mocha": "*",
70-
"should": "*",
71-
"sinon": "*"
66+
"env-test": "^1.0.0",
67+
"eslint": "^4.6.1",
68+
"husky": "^0.14.3",
69+
"mocha": "^3.5.0",
70+
"should": "^13.0.1",
71+
"sinon": "^3.2.1"
7272
}
7373
}

test/cache.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ describe('Cache', () => {
4242
});
4343

4444
it('should return page contents for ls', (done) => {
45-
sinon.stub(fs, 'readFile', (path, encoding, cb) => {
45+
sinon.stub(fs, 'readFile').callsFake((path, encoding, cb) => {
4646
return cb(null, '# ls\n> ls page');
4747
});
4848
sinon.stub(platform, 'getPreferredPlatformFolder').returns('osx');
49-
sinon.stub(index, 'findPlatform', (page, preferredPlatform, done) => {
49+
sinon.stub(index, 'findPlatform').callsFake((page, preferredPlatform, done) => {
5050
return done('osx');
5151
});
5252
cache.getPage('ls', (err, content) => {
@@ -61,11 +61,11 @@ describe('Cache', () => {
6161
});
6262

6363
it('should return empty contents for svcs on OSX', (done) =>{
64-
sinon.stub(fs, 'readFile', (path, encoding, cb) => {
64+
sinon.stub(fs, 'readFile').callsFake((path, encoding, cb) => {
6565
return cb(null, '# svcs\n> svcs');
6666
});
6767
sinon.stub(platform, 'getPreferredPlatformFolder').returns('osx');
68-
sinon.stub(index, 'findPlatform', (page, preferredPlatform, done) => {
68+
sinon.stub(index, 'findPlatform').callsFake((page, preferredPlatform, done) => {
6969
return done(null);
7070
});
7171
cache.getPage('svc', (err, content) => {
@@ -79,11 +79,11 @@ describe('Cache', () => {
7979
});
8080

8181
it('should return page contents for svcs on SunOS', (done) => {
82-
sinon.stub(fs, 'readFile', (path, encoding, cb) => {
82+
sinon.stub(fs, 'readFile').callsFake((path, encoding, cb) => {
8383
return cb(null, '# svcs\n> svcs');
8484
});
8585
sinon.stub(platform, 'getPreferredPlatformFolder').returns('sunos');
86-
sinon.stub(index, 'findPlatform', (page, preferredPlatform, done) => {
86+
sinon.stub(index, 'findPlatform').callsFake((page, preferredPlatform, done) => {
8787
return done('svcs');
8888
});
8989
cache.getPage('svcs', (err, content) => {

test/index.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ describe('Index', () => {
2626
'sunos/du.md',
2727
'sunos/svcs.md'
2828
]);
29-
sinon.stub(fs, 'readFile', (path, encoding, cb) => {
29+
sinon.stub(fs, 'readFile').callsFake((path, encoding, cb) => {
3030
return cb('dummy error', null);
3131
});
32-
sinon.stub(fs, 'writeFile', (path, contents, cb) => {
32+
sinon.stub(fs, 'writeFile').callsFake((path, contents, cb) => {
3333
return cb();
3434
});
3535
});

0 commit comments

Comments
 (0)