Justin Dalrymple db63076a5a
Reach > 90% coverage and add Integration Testing (#709)
- Added many many more unit tests to increase coverage to 90% +
- Removed the upsert functionality of PushRules to maintain documented API parity
2020-06-20 14:55:12 +02:00

40 lines
981 B
TypeScript

import { Projects } from '../../../src';
let service;
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' });
expect(p).toBeInstanceOf(Object);
expect(p.name).toEqual('Project Creation Integration Test');
});
});
describe('Projects.upload', () => {
let project;
beforeAll(async () => {
project = await service.create({ name: 'Project Upload Integration Test' });
});
it('should upload a text file', async () => {
const content = 'TESTING FILE UPLOAD :D';
const results = await service.upload(project.id, content, {
metadata: {
filename: 'testfile.txt',
contentType: 'text/plain',
},
});
expect(results).toContainKeys(['alt', 'url', 'markdown']);
});
});