fix(repos): 修复在全新的工作目录中,检出指定commit时,找不到commit.

This commit is contained in:
Ivan
2021-02-25 15:36:13 +08:00
parent 90d851d85c
commit 5b2a017858
5 changed files with 527 additions and 10 deletions

View File

@@ -2,7 +2,7 @@ import { Test, TestingModule } from '@nestjs/testing';
import { getRepositoryToken } from '@nestjs/typeorm';
import { Project } from '../projects/project.entity';
import { ReposService } from './repos.service';
import { ConfigService, ConfigModule } from '@nestjs/config';
import { ConfigModule } from '@nestjs/config';
import { readFile, rm } from 'fs/promises';
import { join } from 'path';
import configuration from '../commons/config/configuration';
@@ -50,9 +50,7 @@ describe('ReposService', () => {
await rm(service.getWorkspaceRoot(getTest1Project()), {
recursive: true,
}).catch((err) => {
console.log('!!!!', err);
});
}).catch(() => undefined);
});
it('should be defined', () => {
@@ -119,7 +117,7 @@ describe('ReposService', () => {
);
const text = await readFile(filePath, { encoding: 'utf-8' });
expect(text).toMatch(/Commit 1/gi);
});
}, 20_000);
it('should be checkout right commit', async () => {
await service.checkoutCommit(getTest1Project(), '7f7123fe5b');
const filePath = join(
@@ -128,6 +126,6 @@ describe('ReposService', () => {
);
const text = await readFile(filePath, { encoding: 'utf-8' });
expect(text).toMatch(/(?!Commit 1)/gi);
});
}, 20_000);
});
});