Skip to content
This repository has been archived by the owner on Aug 28, 2019. It is now read-only.

Commit

Permalink
feat: add prettier and format files
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Bourrousse committed Nov 8, 2018
1 parent 674b2b4 commit 14195f2
Show file tree
Hide file tree
Showing 13 changed files with 527 additions and 453 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
node_modules/
tmp/
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"trailingComma": "es5",
"semi": true
}
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
* Expose module.
*/

module.exports = require('./lib/taskman');
module.exports = require('./lib/taskman');
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"url": "https://github.com/neoziro/node-taskman/issues"
},
"scripts": {
"test": "mocha --recursive"
"test": "mocha --recursive",
"format": "prettier --write '{lib,test,tmp}/**/*.js' '*.js'"
},
"dependencies": {
"async": "^2.1.4",
Expand All @@ -33,6 +34,7 @@
"devDependencies": {
"chai": "^3.5.0",
"mocha": "^3.2.0",
"prettier": "1.15.1",
"sinon": "^1.17.6",
"sinon-chai": "^2.8.0"
},
Expand Down
12 changes: 6 additions & 6 deletions test/keys/queue.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
var queueKey = require('../../lib/keys/queue');
var expect = require('chai').expect;

describe('Queue key', function () {
describe('#formatList', function () {
it('should format key', function () {
describe('Queue key', function() {
describe('#formatList', function() {
it('should format key', function() {
expect(queueKey.formatList('test')).to.equal('queue:test');
});
});

describe('#formatSet', function () {
it('should format key', function () {
describe('#formatSet', function() {
it('should format key', function() {
expect(queueKey.formatSet('test')).to.equal('unique:test');
});
});
});
});
8 changes: 4 additions & 4 deletions test/keys/worker.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
var workerKey = require('../../lib/keys/worker');
var expect = require('chai').expect;

describe('Worker key', function () {
describe('#formatHash', function () {
it('should format key', function () {
describe('Worker key', function() {
describe('#formatHash', function() {
it('should format key', function() {
expect(workerKey.formatHash('test', 'w1')).to.equal('worker:test:w1');
});
});
});
});
28 changes: 14 additions & 14 deletions test/parsers/json.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
var parser = require('../../lib/parsers/json');
var expect = require('chai').expect;

describe('JSON parser', function () {
describe('#format', function () {
it('should catch errors', function (done) {
describe('JSON parser', function() {
describe('#format', function() {
it('should catch errors', function(done) {
// Create a circular structure.
var obj = {};
obj.obj = obj;

parser.format(obj, function (err) {
parser.format(obj, function(err) {
expect(err).to.exists;
done();
});
});

it('should format data', function (done) {
var obj = {foo: 'bar'};
it('should format data', function(done) {
var obj = { foo: 'bar' };

parser.format(obj, function (err, data) {
parser.format(obj, function(err, data) {
if (err) return done(err);
expect(data).to.equal('{"foo":"bar"}');
done();
});
});
});

describe('#parse', function () {
it('should catch errors', function (done) {
parser.parse('{foo:bar}', function (err) {
describe('#parse', function() {
it('should catch errors', function(done) {
parser.parse('{foo:bar}', function(err) {
expect(err).to.exists;
done();
});
});

it('should parse data', function (done) {
parser.parse('{"foo":"bar"}', function (err, data) {
it('should parse data', function(done) {
parser.parse('{"foo":"bar"}', function(err, data) {
if (err) return done(err);
expect(data).to.eql({foo: 'bar'});
expect(data).to.eql({ foo: 'bar' });
done();
});
});
});
});
});
Loading

0 comments on commit 14195f2

Please sign in to comment.