Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80657 views
1
/**
2
* Copyright (c) 2014, Facebook, Inc. All rights reserved.
3
*
4
* This source code is licensed under the BSD-style license found in the
5
* LICENSE file in the root directory of this source tree. An additional grant
6
* of patent rights can be found in the PATENTS file in the same directory.
7
*/
8
'use strict';
9
10
jest.autoMockOff();
11
12
describe('utils-pathNormalize', function() {
13
var utils;
14
15
beforeEach(function() {
16
utils = require('../utils');
17
});
18
19
it('supports ../ paths and unix separators', function() {
20
var path = '/path/to/__tests__/foo/bar/baz/../../../test.js';
21
var pathNormalized = utils.pathNormalize(path);
22
23
return expect(pathNormalized).toEqual('/path/to/__tests__/test.js');
24
});
25
26
it('supports ../ paths and windows separators', function() {
27
var path = 'c:\\path\\to\\__tests__\\foo\\bar\\baz\\..\\..\\..\\test.js';
28
var pathNormalized = utils.pathNormalize(path);
29
30
return expect(pathNormalized).toEqual('c:/path/to/__tests__/test.js');
31
});
32
33
it('supports unix separators', function() {
34
var path = '/path/to/__tests__/test.js';
35
var pathNormalized = utils.pathNormalize(path);
36
37
return expect(pathNormalized).toEqual(path);
38
});
39
40
it('supports windows separators', function() {
41
var path = 'c:\\path\\to\\__tests__\\test.js';
42
var pathNormalized = utils.pathNormalize(path);
43
44
return expect(pathNormalized).toEqual('c:/path/to/__tests__/test.js');
45
});
46
});
47
48