mirror of
https://github.com/expo/babel-plugin-module-resolver.git
synced 2026-11-14 17:48:35 -10:00
23 lines
651 B
JavaScript
23 lines
651 B
JavaScript
import path from 'path';
|
|
|
|
import mapToRelative from '../src/mapToRelative';
|
|
|
|
|
|
describe('mapToRelative', () => {
|
|
describe('should map to relative path with a custom cwd', () => {
|
|
it('with a relative filename', () => {
|
|
const currentFile = './utils/test/file.js';
|
|
const result = mapToRelative(path.resolve('./test'), currentFile, 'utils/dep');
|
|
|
|
expect(result).toBe('../dep');
|
|
});
|
|
|
|
it('with an absolute filename', () => {
|
|
const currentFile = path.resolve('./utils/test/file.js');
|
|
const result = mapToRelative(path.resolve('.'), currentFile, 'utils/dep');
|
|
|
|
expect(result).toBe('../dep');
|
|
});
|
|
});
|
|
});
|