feat(core): initial implementation of @apiclient.xyz/gitea TypeScript client
Provides GiteaClient class with methods for repos, orgs, secrets, and action runs.
This commit is contained in:
34
test/test.node.ts
Normal file
34
test/test.node.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { tap, expect } from '@push.rocks/tapbundle';
|
||||
import * as qenv from '@push.rocks/qenv';
|
||||
import { GiteaClient } from '../ts/index.js';
|
||||
|
||||
const testQenv = new qenv.Qenv('./', '.nogit/');
|
||||
|
||||
let giteaClient: GiteaClient;
|
||||
|
||||
tap.test('should create a GiteaClient instance', async () => {
|
||||
const baseUrl = testQenv.getEnvVarOnDemand('GITEA_BASE_URL') || 'https://gitea.lossless.digital';
|
||||
const token = testQenv.getEnvVarOnDemand('GITEA_TOKEN') || '';
|
||||
giteaClient = new GiteaClient(baseUrl, token);
|
||||
expect(giteaClient).toBeInstanceOf(GiteaClient);
|
||||
});
|
||||
|
||||
tap.test('should test connection', async () => {
|
||||
const result = await giteaClient.testConnection();
|
||||
expect(result).toHaveProperty('ok');
|
||||
console.log('Connection test:', result);
|
||||
});
|
||||
|
||||
tap.test('should get repos', async () => {
|
||||
const repos = await giteaClient.getRepos({ perPage: 5 });
|
||||
expect(repos).toBeArray();
|
||||
console.log(`Found ${repos.length} repos`);
|
||||
});
|
||||
|
||||
tap.test('should get orgs', async () => {
|
||||
const orgs = await giteaClient.getOrgs({ perPage: 5 });
|
||||
expect(orgs).toBeArray();
|
||||
console.log(`Found ${orgs.length} orgs`);
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
Reference in New Issue
Block a user