38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import { tap, expect } from '@push.rocks/tapbundle';
|
|
import * as smartgit from '../ts/index.js';
|
|
|
|
import * as smartpath from '@push.rocks/smartpath';
|
|
import * as path from 'path';
|
|
|
|
let testSmartgitInstance: smartgit.Smartgit;
|
|
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();
|
|
await testSmartgitInstance.init();
|
|
expect(testSmartgitInstance).toBeInstanceOf(smartgit.Smartgit);
|
|
});
|
|
|
|
tap.test('should create a new repo at .nogit', async () => {
|
|
const gitRepo = await testSmartgitInstance.createRepoByOpen(testRepoDir);
|
|
});
|
|
|
|
tap.test('should clone a repo', async () => {
|
|
const gitRepo = await testSmartgitInstance.createRepoByClone(
|
|
'https://gitlab.com/push.rocks/smartfile.git',
|
|
testRepoDirSmartfile
|
|
);
|
|
});
|
|
|
|
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();
|