31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
|
import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
|
||
|
import * as codefeed from '../ts/index.js';
|
||
|
import * as qenv from '@push.rocks/qenv';
|
||
|
const testQenv = new qenv.Qenv('./', '.nogit/');
|
||
|
|
||
|
|
||
|
let testCodeFeed: codefeed.CodeFeed;
|
||
|
|
||
|
tap.test('first test', async () => {
|
||
|
const token = await testQenv.getEnvVarOnDemand('GITEA_TOKEN');
|
||
|
// console.log('token', token);
|
||
|
testCodeFeed = new codefeed.CodeFeed('https://code.foss.global', token);
|
||
|
expect(testCodeFeed).toBeInstanceOf(codefeed.CodeFeed);
|
||
|
});
|
||
|
|
||
|
tap.test('fetchAllCommitsFromInstance', async () => {
|
||
|
const commits = await testCodeFeed.fetchAllCommitsFromInstance();
|
||
|
expect(commits).toBeArray();
|
||
|
expect(commits.length).toBeGreaterThan(0);
|
||
|
// expect(commits[0]).toBeTypeofObject();
|
||
|
expect(commits[0].baseUrl).toBeTypeofString();
|
||
|
expect(commits[0].org).toBeTypeofString();
|
||
|
expect(commits[0].repo).toBeTypeofString();
|
||
|
expect(commits[0].timestamp).toBeTypeofString();
|
||
|
expect(commits[0].hash).toBeTypeofString();
|
||
|
expect(commits[0].commitMessage).toBeTypeofString();
|
||
|
expect(commits[0].tagged).toBeTypeofBoolean();
|
||
|
});
|
||
|
|
||
|
tap.start();
|