Files
gitlab/test/test.node.ts
Juergen Kunz b0f56f5948 BREAKING CHANGE(gitlab): rename to @apiclient.xyz/gitlab v2.0.0 with new GitLabClient API
Replaces legacy @mojoio/gitlab with modern ESM TypeScript client supporting projects, groups, CI/CD variables, and pipelines.
2026-02-24 12:50:18 +00:00

35 lines
1.1 KiB
TypeScript

import { tap, expect } from '@push.rocks/tapbundle';
import * as qenv from '@push.rocks/qenv';
import { GitLabClient } from '../ts/index.js';
const testQenv = new qenv.Qenv('./', '.nogit/');
let gitlabClient: GitLabClient;
tap.test('should create a GitLabClient instance', async () => {
const baseUrl = testQenv.getEnvVarOnDemand('GITLAB_BASE_URL') || 'https://gitlab.com';
const token = testQenv.getEnvVarOnDemand('GITLAB_TOKEN') || '';
gitlabClient = new GitLabClient(baseUrl, token);
expect(gitlabClient).toBeInstanceOf(GitLabClient);
});
tap.test('should test connection', async () => {
const result = await gitlabClient.testConnection();
expect(result).toHaveProperty('ok');
console.log('Connection test:', result);
});
tap.test('should get projects', async () => {
const projects = await gitlabClient.getProjects({ perPage: 5 });
expect(projects).toBeArray();
console.log(`Found ${projects.length} projects`);
});
tap.test('should get groups', async () => {
const groups = await gitlabClient.getGroups({ perPage: 5 });
expect(groups).toBeArray();
console.log(`Found ${groups.length} groups`);
});
export default tap.start();