fix(GitRepo): add diff function
This commit is contained in:
14
test/test.ts
14
test/test.ts
@ -2,12 +2,12 @@ import { tap, expect } from '@push.rocks/tapbundle';
|
||||
import * as smartgit from '../ts/index.js';
|
||||
|
||||
import * as smartpath from '@push.rocks/smartpath';
|
||||
const __dirname = smartpath.get.dirnameFromImportMetaUrl(import.meta.url);
|
||||
import * as path from 'path';
|
||||
|
||||
let testSmartgitInstance: smartgit.Smartgit;
|
||||
const testRepoDir = path.join(__dirname, '../.nogit/testrepo');
|
||||
const testRepoDirSmartfile = path.join(__dirname, '../.nogit/pushrocks_smartfile');
|
||||
const packageDir = path.join(smartpath.get.dirnameFromImportMetaUrl(import.meta.url), '../');
|
||||
const testRepoDir = path.join(packageDir, './.nogit/testrepo');
|
||||
const testRepoDirSmartfile = path.join(packageDir, './.nogit/pushrocks_smartfile');
|
||||
|
||||
tap.test('should create a valid smartgit instance', async () => {
|
||||
testSmartgitInstance = new smartgit.Smartgit();
|
||||
@ -26,4 +26,12 @@ tap.test('should clone a repo', async () => {
|
||||
);
|
||||
});
|
||||
|
||||
tap.test('should open a repo', async () => {
|
||||
const gitRepo = await testSmartgitInstance.createRepoByOpen(packageDir);
|
||||
const diff = await gitRepo.getUncommittedDiff([
|
||||
'pnpm-lock.yaml',
|
||||
]);
|
||||
console.log(diff);
|
||||
});
|
||||
|
||||
await tap.start();
|
||||
|
Reference in New Issue
Block a user