summaryrefslogtreecommitdiffstats
path: root/lib/utils/__tests__/path.js
blob: 22bb01695b85c9ed4ab7e9ed34da7894861bf1fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var path = require('path');

describe('Paths', function() {
    var PathUtils = require('..//path');

    describe('setExtension', function() {
        it('should correctly change extension of filename', function() {
            expect(PathUtils.setExtension('test.md', '.html')).toBe('test.html');
            expect(PathUtils.setExtension('test.md', '.json')).toBe('test.json');
        });

        it('should correctly change extension of path', function() {
            expect(PathUtils.setExtension('hello/test.md', '.html')).toBe(path.normalize('hello/test.html'));
            expect(PathUtils.setExtension('hello/test.md', '.json')).toBe(path.normalize('hello/test.json'));
        });
    });
});