initial
This commit is contained in:
30
test/test.ts
Normal file
30
test/test.ts
Normal file
@ -0,0 +1,30 @@
|
||||
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();
|
Reference in New Issue
Block a user