Justin Dalrymple 502d8180a7
Update service typing and peripheral endpoints (#1768)
* Dependency and Configuration updates
* CHANGELOG and README updates
* Added support for camel case and snake case response types in the request helper and base service
* Added support for the Dockerfile Templates API
* Added support for the Issue Note Award Emojis API
* Removed redundant Group Projects service
* Updated types for a variety of services
* Added type updates and removed protect and unprotect endpoints from the Branches API 
* Added type updates and signature endpoint to the Commits API
* Added type updates and edit support to the Deployments API
* Added type updates and a showRepository function to the Container Registry API
* Added type updates and updated the service support to include create, edit, show and remove for the Feature Flags API
* Added type updates and support for the removal of geonodes with the Geo Nodes API
* Renamed UserKeys to UserSSHKeys and added type updates for the User SSH Keys API
* Added type updates for the License Templates API and renamed the export to fix the spelling error
* Added type updates and support for the transfer projects endpoint for the Groups API
* Added type updates and removed removed events endpoint on the Projects API
* Added type updates and modified the create function to require a resource name in the Todos API
2021-05-14 10:07:11 -04:00

59 lines
1.6 KiB
TypeScript

import { Projects } from '../../../src';
const { TEST_ID } = process.env;
let service: InstanceType<typeof Projects>;
beforeEach(() => {
service = new Projects({
host: process.env.GITLAB_URL,
token: process.env.PERSONAL_ACCESS_TOKEN,
});
});
describe('Projects.create', () => {
it('should create a valid project', async () => {
const p = await service.create({ name: `Project Creation Integration Test ${TEST_ID}` });
expect(p).toBeInstanceOf(Object);
expect(p.name).toEqual(`Project Creation Integration Test ${TEST_ID}`);
});
});
describe.skip('Projects.all', () => {
beforeAll(async () => {
const newProjects: any[] = [];
for (let i = 0; i < 100; i += 1) {
newProjects.push(service.create({ name: `Project All Integration Test ${TEST_ID} ${i}` }));
}
await Promise.all(newProjects);
});
it('should get 40 projects using offset pagination', async () => {
const projects = await service.all({ maxPages: 2 });
expect(projects).toBeInstanceOf(Array);
expect(projects).toHaveLength(40);
});
});
// TODO: Determine config changes required for this test.
// Local testing works
describe.skip('Projects.upload', () => {
it('should upload a text file', async () => {
const project = await service.create({
name: `Project Upload Integration Test Text File ${TEST_ID}`,
});
const results = await service.upload(project.id, 'TESTING FILE UPLOAD', {
metadata: {
filename: 'testfile.txt',
contentType: 'text/plain',
},
});
expect(results).toContainKeys(['alt', 'url', 'full_path', 'markdown']);
});
});