36 lines
1.4 KiB
TypeScript
36 lines
1.4 KiB
TypeScript
import { expect, tap } from '@pushrocks/tapbundle';
|
|
import * as gitlab from '../ts/index';
|
|
|
|
let testGitlabAccount: gitlab.GitlabAccount;
|
|
|
|
tap.test('should create an anonymous Gitlab Account', async () => {
|
|
testGitlabAccount = gitlab.GitlabAccount.createAnonymousAccount();
|
|
expect(testGitlabAccount).to.be.instanceOf(gitlab.GitlabAccount);
|
|
});
|
|
|
|
tap.test('should get the pushrocks group', async () => {
|
|
const pushrocksGroup = await testGitlabAccount.getGroupByName('pushrocks');
|
|
expect(pushrocksGroup).to.be.instanceOf(gitlab.GitlabGroup);
|
|
console.log(pushrocksGroup);
|
|
});
|
|
|
|
tap.test('should get the pushrocks group', async () => {
|
|
const pushrocksGroup = await testGitlabAccount.getGroupByName('pushrocks');
|
|
expect(pushrocksGroup).to.be.instanceOf(gitlab.GitlabGroup);
|
|
await pushrocksGroup.getProjects();
|
|
});
|
|
|
|
tap.test('should get the readme of a project', async () => {
|
|
const pushrocksGroup = await testGitlabAccount.getGroupByName('pushrocks');
|
|
expect(pushrocksGroup).to.be.instanceOf(gitlab.GitlabGroup);
|
|
const projects = await pushrocksGroup.getProjects();
|
|
const selectedProject = projects.find((project) => {
|
|
return project.data?.name === 'smartfile';
|
|
});
|
|
expect(selectedProject.data.name).to.equal('smartfile');
|
|
const readme = await selectedProject.getReadmeAsMarkdown('master');
|
|
expect(readme).to.startWith('# @pushrocks/smartfile');
|
|
});
|
|
|
|
tap.start();
|