From 202c235c665ff2dc007a013b45bff787ee82176b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Thu, 18 Feb 2016 12:15:53 +0100 Subject: [PATCH] Add tests for path utils module --- test/all.js | 1 + test/paths.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 test/paths.js diff --git a/test/all.js b/test/all.js index 97913d7f3..d8f227561 100644 --- a/test/all.js +++ b/test/all.js @@ -1,6 +1,7 @@ // Utilities require('./location'); +require('./paths'); // Parsing require('./config'); diff --git a/test/paths.js b/test/paths.js new file mode 100644 index 000000000..c7929d346 --- /dev/null +++ b/test/paths.js @@ -0,0 +1,16 @@ +var pathUtils = require('../lib/utils/path'); + +describe('Paths', function() { + + describe('setExtension', function() { + it('should correctly change extension of filename', function() { + pathUtils.setExtension('test.md', '.html').should.be.equal('test.html'); + pathUtils.setExtension('test.md', '.json').should.be.equal('test.json'); + }); + + it('should correctly change extension of path', function() { + pathUtils.setExtension('hello/test.md', '.html').should.be.equal('hello/test.html'); + pathUtils.setExtension('hello/test.md', '.json').should.be.equal('hello/test.json'); + }); + }); +});