support local

This commit is contained in:
Opportunity
2020-07-17 11:45:52 +08:00
Unverified
parent bff8013f3d
commit fad1ce1d16
27 changed files with 581 additions and 322 deletions
+22
View File
@@ -271,6 +271,7 @@ jest.mock('./git', () => ({
}));
import { selectVersion } from './versions';
import { Repo } from './interfaces';
import { resolve } from 'path';
describe('selectVersion', () => {
it('should return correct version for latest', async () => {
@@ -411,4 +412,25 @@ describe('selectVersion', () => {
type: 'heads',
});
});
it('should return local cwd', async () => {
await expect(selectVersion('local#')).resolves.toEqual({
path: process.cwd(),
type: 'local',
});
});
it('should return absolute path', async () => {
await expect(selectVersion('local#/usr/bin')).resolves.toEqual({
path: resolve('/usr/bin'),
type: 'local',
});
});
it('should return relative path', async () => {
await expect(selectVersion('local#xmake')).resolves.toEqual({
path: resolve('xmake'),
type: 'local',
});
});
});