minor fix & grammar

master
Gregory Scheerlinck 8 years ago
parent 61585851b3
commit 2d6308a47c

@ -11,27 +11,23 @@ var fsUnlink = Promise.promisify(require('fs').unlink);
var path = require('path');
describe('methods', function() {
it('has a convert function', function() {
it('should have a convert function', function() {
expect(fileio.convert).to.be.a('function');
});
it('has a getContents function', function() {
it('should have a getContents function', function() {
expect(fileio.getContents).to.be.a('function');
});
it('has a tmpSave function', function() {
it('should have a tmpSave function', function() {
expect(fileio.tmpSave).to.be.a('function');
});
it('has a removeTmp function', function() {
it('should have a removeTmp function', function() {
expect(fileio.removeTmp).to.be.a('function');
});
it('has a processMd function', function() {
expect(fileio.processMd).to.be.a('function');
});
it('has a getTmp function', function() {
it('should have a getTmp function', function() {
expect(fileio.getTmp).to.be.a('function');
});
});
@ -51,7 +47,7 @@ describe('getContents', function() {
}).catch(function(err) { console.log(err);});
});
it('takes in an article object and adds contents to it', function(done) {
it('should take in an article object and adds contents to it', function(done) {
fileio.getContents(mockArticle).then(function(newArticle) {
expect(newArticle.title).to.equal(finishedMockArticle.title);
expect(newArticle.mdPath).to.equal(finishedMockArticle.path);
@ -78,15 +74,15 @@ describe('convert', function() {
}).catch(function(err) { console.log(err); });
});
it('converts articles from md to roff', function() {
expect(fileio.convert(contents)).to.contain(goodRoff.substr(1, -1).trim());
it('should convert articles from md to roff', function() {
expect(fileio.convert(contents, {})).to.contain(goodRoff.substr(1, -1).trim());
});
});
describe('tmpSave', function() {
var tmp = null;
it('saves a temporary file', function(done) {
it('should save a temporary file', function(done) {
fileio.tmpSave('hello world').then(function(tmpFile) {
tmp = tmpFile;
expect(tmpFile).to.equal(path.resolve(fileio.getTmp()));
@ -111,7 +107,7 @@ describe('removeTmp', function() {
});
});
it('deletes the temporary file', function(done) {
it('should delete the temporary file', function(done) {
fileio.removeTmp().then(function(result) {
expect(result).to.equal('done');
done();
@ -119,20 +115,8 @@ describe('removeTmp', function() {
});
});
describe('processMd', function() {
var article = {
contents: '[foo](http://www.bar.com)',
};
it('processes the markdown', function() {
var converted = fileio.processMd(article);
expect(converted).to.be.an('object');
expect(converted.contents).to.equal('foo\n');
});
});
describe('getTmp', function() {
it('gets the tmpfile location', function() {
it('should get the tmpfile location', function() {
expect(fileio.getTmp()).to.be.a('string');
});
});

@ -11,11 +11,11 @@ var find = require('../lib/find');
// var path = require('path');
describe('methods', function() {
it('has a narrowDown function', function() {
it('should have a narrowDown function', function() {
expect(find.narrowDown).to.be.a('function');
});
it('has a selectArticle function', function() {
it('should have a selectArticle function', function() {
expect(find.selectArticle).to.be.a('function');
});
});
@ -23,12 +23,12 @@ describe('methods', function() {
describe('narrowDown', function() {
var articles = [{title: 'foo1'}, {title: 'bar foo 2'}, {title: 'bar'}];
it('returns empty array if no terms match', function() {
it('should return empty array if no terms match', function() {
expect(find.narrowDown(articles, ['baz', 'bam']).length).to.equal(0);
expect(find.narrowDown(articles, ['foo bar']).length).to.equal(0);
});
it('returns the matching articles', function() {
it('should return the matching articles', function() {
expect(find.narrowDown(articles, ['bar foo']).length).to.equal(1);
expect(find.narrowDown(articles, ['foo', 'bar']).length).to.equal(1);
expect(find.narrowDown(articles, ['foo']).length).to.equal(2);
@ -37,7 +37,7 @@ describe('narrowDown', function() {
});
describe('selectArticle', function() {
it('throws an error if the passed in articles array is empty', function(done) {
it('should throw an error if the passed in articles array is empty', function(done) {
find.selectArticle([], 'english').then(function() {
// this should never run
console.warning('check ./test/find.js because you should never see this');
@ -49,7 +49,7 @@ describe('selectArticle', function() {
});
});
it('returns the article when the passed in articles array only contains one item', function(done) {
it('should return the article when the passed in articles array only contains one item', function(done) {
find.selectArticle([{title: 'foo'}]).then(function(data) {
expect(data).to.be.an('object');
done();

@ -8,7 +8,7 @@ var util = require('../lib/util');
var path = require('path');
describe('methods', function() {
it('has a getArticlePath function', function() {
it('should have a getArticlePath function', function() {
expect(util.getArticlePath).to.be.a('function');
});
});
@ -20,7 +20,7 @@ describe('relativeArticlePath', function() {
var reFooToMatch = new RegExp(path.join('node_modules', 'arch-wiki-md-repo', 'wiki', '_content', 'foo.md'), 'i');
var reBarToMatch = new RegExp(path.join('node_modules', 'arch-wiki-md-repo', 'wiki', '_content', 'bar.md'), 'i');
it('converts relative paths from the db to absolute', function() {
it('should convert relative paths from the db to absolute', function() {
expect(convertedFoo).to.match(reFooToMatch);
expect(convertedBar).to.match(reBarToMatch);
});

Loading…
Cancel
Save