Skip to content

Commit

Permalink
updates due to pull request #2
Browse files Browse the repository at this point in the history
  • Loading branch information
sagiegurari committed Feb 2, 2017
1 parent ac5e152 commit 8f8b03a
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ See [contributing guide](.github/CONTRIBUTING.md)

| Date | Version | Description |
| ----------- | ------- | ----------- |
| 2017-01-13 | v1.0.22 | Maintenance |
| 2017-02-02 | v1.0.23 | Maintenance |
| 2016-11-04 | v1.0.11 | Support new markdownlint 0.3.0 options |
| 2016-11-04 | v1.0.10 | Maintenance |
| 2016-07-01 | v0.1.0 | Updated task config to use options |
Expand Down
2 changes: 1 addition & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
| Date | Version | Description |
| ----------- | ------- | ----------- |
| 2017-01-13 | v1.0.22 | Maintenance |
| 2017-02-02 | v1.0.23 | Maintenance |
| 2016-11-04 | v1.0.11 | Support new markdownlint 0.3.0 options |
| 2016-11-04 | v1.0.10 | Maintenance |
| 2016-07-01 | v0.1.0 | Updated task config to use options |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "grunt-markdownlint",
"version": "1.0.22",
"version": "1.0.23",
"description": "A grunt task for markdown style checker and lint tool.",
"author": {
"name": "Sagie Gur-Ari",
Expand Down
2 changes: 1 addition & 1 deletion tasks/linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Linter.prototype.run = function (grunt, markdownlint) {

var data = self.options({});

var files = self.filesSrc;
var files = self.filesSrc || [];
var filesNumber = files.length;

//set mandatory options
Expand Down
36 changes: 25 additions & 11 deletions test/spec/grunt-markdownlint-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,47 @@ var chai = require('chai');
var assert = chai.assert;
var task = require('../../tasks/grunt-markdownlint');

describe('Grunt Markdownlint Tests', function () {
it('regsiter test', function (done) {
describe('Grunt Markdownlint', function () {
it('register', function (done) {
var registerCalled = false;
var okCalled = false;

var taskFunction = task({
var grunt = {
registerMultiTask: function (name, taskFunc) {
assert.equal(name, 'markdownlint');
assert.isFunction(taskFunc);

registerCalled = true;
}
});

assert.isTrue(registerCalled);
assert.isFunction(taskFunction);

taskFunction.call({
},
options: function () {
return {};
},
async: function () {
return function (valid) {
assert.isTrue(valid);
assert.isTrue(okCalled);

done();
};
},
log: {
ok: function () {
okCalled = true;
}
},
util: {
pluralize: function (number, message) {
assert.isNumber(number);
assert.isDefined(message);
}
}
});
};

var taskFunction = task(grunt);

assert.isTrue(registerCalled);
assert.isFunction(taskFunction);

taskFunction.call(grunt);
});
});
27 changes: 19 additions & 8 deletions test/spec/linter-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,20 @@ var chai = require('chai');
var assert = chai.assert;
var Linter = require('../../tasks/linter');

describe('Linter Tests', function () {
describe('Linter', function () {
describe('run', function () {
var grunt = {
log: {
ok: function (message) {
assert.isDefined(message);
}
},
util: {
pluralize: function (number, message) {
assert.isNumber(number);
assert.isDefined(message);
}
},
fail: {
warn: function () {
assert.fail();
Expand Down Expand Up @@ -47,7 +58,7 @@ describe('Linter Tests', function () {
lintCalled = true;

assert.deepEqual(options, {
files: undefined,
files: [],
config: undefined
});

Expand All @@ -72,7 +83,7 @@ describe('Linter Tests', function () {
lintCalled = true;

assert.deepEqual(options, {
files: undefined,
files: [],
config: undefined
});

Expand Down Expand Up @@ -124,7 +135,7 @@ describe('Linter Tests', function () {
lintCalled = true;

assert.deepEqual(options, {
files: undefined,
files: [],
config: ['test', true, 5]
});

Expand All @@ -151,7 +162,7 @@ describe('Linter Tests', function () {
lintCalled = true;

assert.deepEqual(options, {
files: undefined,
files: [],
config: undefined,
strings: 'test string'
});
Expand Down Expand Up @@ -179,7 +190,7 @@ describe('Linter Tests', function () {
lintCalled = true;

assert.deepEqual(options, {
files: undefined,
files: [],
config: undefined,
frontMatter: 'test frontMatter'
});
Expand Down Expand Up @@ -213,7 +224,7 @@ describe('Linter Tests', function () {
lintCalled = true;

assert.deepEqual(options, {
files: undefined,
files: [],
config: undefined
});

Expand Down Expand Up @@ -248,7 +259,7 @@ describe('Linter Tests', function () {
lintCalled = true;

assert.deepEqual(options, {
files: undefined,
files: [],
config: undefined
});

Expand Down

0 comments on commit 8f8b03a

Please sign in to comment.