Skip to content

Commit

Permalink
added test to accept if summary is nonexistent
Browse files Browse the repository at this point in the history
  • Loading branch information
dangoosby committed Mar 29, 2018
1 parent b132edc commit a717a53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
8 changes: 0 additions & 8 deletions lib/linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,6 @@ const lint = (objectName, object, options = {}) => {
});
}
}
if (rule.exists) {
const { value, property } = rule.exists;
if (object[property]) {
ensure(rule, () => {
object[property].should.not.exist(value);
})
}
}
}
}
}
Expand Down
21 changes: 6 additions & 15 deletions test/linter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,28 +118,19 @@ describe('linter.js', () => {
done();
});

it('is fine if there is no summary', done => {
const input = { foo: '123'};
lintAndExpectValid(rule, input);
done();
});

it('errors when string is too long', done => {
const input = { summary: '123456' };
lintAndExpectErrors(rule, input, ['gotta-be-five']);
done();
});
});

context('exists', () => {
const rule = {
"name": "exists",
"object": "*",
"enabled": true,
"exists": { "property": "summary", "value": null }
};

it('accepts when value is nonexistent', done => {
const input = { summary: null };
lintAndExpectValid(rule, input);
done();
})
});

context('pattern', () => {
context('when split and omit arguments are used', () => {
const rule = {
Expand Down

0 comments on commit a717a53

Please sign in to comment.