summaryrefslogtreecommitdiffstats
path: root/lib/utils/__tests__/location.js
blob: 183086d7cf351e7e2c102987c9e4589e23a6d38f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
jest.autoMockOff();

describe('LocationUtils', function() {
    var LocationUtils = require('../location');

    describe('toAbsolute', function() {

        it('should resolve path starting by "/" in root directory', function() {
            expect(
                LocationUtils.toAbsolute('/test/hello.md', './', './')
            ).toBe('test/hello.md');
        });

        it('should resolve path starting by "/" in child directory', function() {
            expect(
                LocationUtils.toAbsolute('/test/hello.md', './hello', './')
            ).toBe('test/hello.md');
        });

        it('should resolve path starting by "/" in child directory, with same output directory', function() {
            expect(
                LocationUtils.toAbsolute('/test/hello.md', './hello', './hello')
            ).toBe('../test/hello.md');
        });
    });

});