1import { matchTsConfigPathAlias } from '../matchTsConfigPathAlias'; 2 3describe(matchTsConfigPathAlias, () => { 4 it('matches a simple alias', () => { 5 const pathsKeys = ['@foo/*']; 6 const moduleName = '@foo/bar'; 7 expect(matchTsConfigPathAlias(pathsKeys, moduleName)).toEqual({ 8 text: '@foo/*', 9 star: 'bar', 10 }); 11 }); 12 it('matches a simple alias with a dot', () => { 13 const pathsKeys = ['@foo/*']; 14 const moduleName = '@foo/bar.baz'; 15 expect(matchTsConfigPathAlias(pathsKeys, moduleName)).toEqual({ 16 text: '@foo/*', 17 star: 'bar.baz', 18 }); 19 }); 20 it('matches a simple alias with a dot and a slash', () => { 21 const pathsKeys = ['@foo/*']; 22 const moduleName = '@foo/bar.baz/qux'; 23 expect(matchTsConfigPathAlias(pathsKeys, moduleName)).toEqual({ 24 text: '@foo/*', 25 star: 'bar.baz/qux', 26 }); 27 }); 28}); 29