mirror of
https://github.com/jdalrymple/gitbeaker.git
synced 2026-01-18 15:55:30 +00:00
66 lines
1.9 KiB
TypeScript
66 lines
1.9 KiB
TypeScript
import { NotificationSettings, Projects, Groups } from '../../../src';
|
|
|
|
let service;
|
|
let group;
|
|
let project;
|
|
|
|
beforeAll(async () => {
|
|
const config = {
|
|
host: process.env.GITLAB_URL,
|
|
token: process.env.PERSONAL_ACCESS_TOKEN,
|
|
};
|
|
const projectService = new Projects(config);
|
|
const groupService = new Groups(config);
|
|
|
|
service = new NotificationSettings(config);
|
|
|
|
group = await groupService.create(
|
|
'Notification Settings Integration Test',
|
|
'notification-settings-integration-test',
|
|
);
|
|
project = await projectService.create({ name: 'Notification Settings Integration Test' });
|
|
});
|
|
|
|
describe('NotificationSettings.all', () => {
|
|
it('should return all the global notification settings', async () => {
|
|
const settings = await service.all();
|
|
|
|
expect(settings).toBeObject();
|
|
});
|
|
|
|
it('should return all the group notification settings', async () => {
|
|
const settings = await service.all({ groupId: group.id });
|
|
|
|
expect(settings).toBeObject();
|
|
});
|
|
|
|
it('should return all the project notification settings', async () => {
|
|
const settings = await service.all({ projectId: project.id });
|
|
|
|
expect(settings).toBeObject();
|
|
});
|
|
});
|
|
|
|
describe('NotificationSettings.edit', () => {
|
|
it('should return edit the global notification settings', async () => {
|
|
const settings = await service.edit({ level: 'watch' });
|
|
|
|
expect(settings).toBeObject();
|
|
expect(settings).toContainEntry(['level', 'watch']);
|
|
});
|
|
|
|
it('should return edit the group notification settings', async () => {
|
|
const settings = await service.edit({ groupId: group.id, level: 'watch' });
|
|
|
|
expect(settings).toBeObject();
|
|
expect(settings).toContainEntry(['level', 'watch']);
|
|
});
|
|
|
|
it('should return edit the project notification settings', async () => {
|
|
const settings = await service.edit({ projectId: project.id, level: 'watch' });
|
|
|
|
expect(settings).toBeObject();
|
|
expect(settings).toContainEntry(['level', 'watch']);
|
|
});
|
|
});
|