gitlab/test/test.ts

36 lines
1.4 KiB
TypeScript
Raw Normal View History

2021-05-16 23:50:56 +00:00
import { expect, tap } from '@pushrocks/tapbundle';
2021-05-16 12:16:35 +00:00
import * as gitlab from '../ts/index';
2017-06-10 13:51:27 +00:00
2021-05-16 12:16:35 +00:00
let testGitlabAccount: gitlab.GitlabAccount;
2017-06-10 13:51:27 +00:00
2021-05-16 12:16:35 +00:00
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();
});
2021-05-16 23:50:56 +00:00
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');
});
2021-05-16 12:16:35 +00:00
tap.start();