setup-maven/__tests__/utils.test.ts

17 lines
436 B
TypeScript
Raw Normal View History

import * as path from 'path';
import { getVersionFromToolcachePath } from '../src/utils';
describe('getVersionFromToolcachePath', () => {
it.each([
['', ''],
['foo', '.'],
[path.join('foo', '1.0', 'x64'), '1.0'],
[`bar${path.sep}foo${path.sep}`, 'bar']
])('%s -> %s', (toolPath: string, expected: string) => {
const actual = getVersionFromToolcachePath(toolPath);
expect(actual).toBe(expected);
});
});