Skip to content

Commit

Permalink
Adjust mocks to account for root expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
tclindner committed May 15, 2018
1 parent e3cd949 commit 7920c02
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/unit/Config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -797,9 +797,10 @@ describe('Config Unit Tests', function() {
}
});
stubLoadPkgJson.returns({root: true, rules: {}});
stubLoad.returns({rules: {'require-name': 'error'}});
stubLoad.returns({root: true, rules: {'require-name': 'error'}});

const expectedConfigObj = {
root: true,
rules: {
'require-name': 'error'
}
Expand Down Expand Up @@ -1031,7 +1032,8 @@ describe('Config Unit Tests', function() {
const stubLoadPkgJson = sinon.stub(ConfigFile, 'loadFromPackageJson');
const stubLoad = sinon.stub(ConfigFile, 'load');

stubDirname.returns('./npm-package-json-lint/');
stubDirname.onCall(0).returns('./npm-package-json-lint/');
stubDirname.onCall(1).returns('/home');
stubExists.returns(false);

const expectedConfigObj = {
Expand All @@ -1040,7 +1042,7 @@ describe('Config Unit Tests', function() {
const filePath = './package.json';
const result = config.getProjectHierarchyConfig(filePath);

stubDirname.calledOnce.should.be.true;
stubDirname.calledTwice.should.be.true;
stubDirname.firstCall.calledWithExactly(filePath).should.be.true;

stubExists.calledThrice.should.be.true;
Expand Down Expand Up @@ -1078,7 +1080,8 @@ describe('Config Unit Tests', function() {
const stubLoadPkgJson = sinon.stub(ConfigFile, 'loadFromPackageJson');
const stubLoad = sinon.stub(ConfigFile, 'load');

stubDirname.returns('./npm-package-json-lint/');
stubDirname.onCall(0).returns('./npm-package-json-lint/');
stubDirname.onCall(1).returns('/home');
stubExists.returns(true);
stubStats.returns({
isFile: function() {
Expand All @@ -1095,7 +1098,7 @@ describe('Config Unit Tests', function() {
const filePath = './package.json';
const result = config.getProjectHierarchyConfig(filePath);

stubDirname.calledOnce.should.be.true;
stubDirname.calledTwice.should.be.true;
stubDirname.firstCall.calledWithExactly(filePath).should.be.true;

stubExists.calledOnce.should.be.true;
Expand Down

0 comments on commit 7920c02

Please sign in to comment.