gitbeaker/packages/core/test/unit/resources/ApplicationSettings.ts
2023-05-22 00:16:22 -04:00

35 lines
950 B
TypeScript

import { RequestHelper } from '../../../src/infrastructure';
import { ApplicationSettings } from '../../../src';
jest.mock(
'../../../src/infrastructure/RequestHelper',
() => require('../../__mocks__/RequestHelper').default,
);
let service: ApplicationSettings;
beforeEach(() => {
service = new ApplicationSettings({
requesterFn: jest.fn(),
token: 'abcdefg',
});
});
describe('ApplicationSettings.show', () => {
it('should request GET /application/settings', async () => {
await service.show();
expect(RequestHelper.get()).toHaveBeenCalledWith(service, 'application/settings', undefined);
});
});
describe('ApplicationSettings.edit', () => {
it('should request PUT /application/settings with a terms property', async () => {
await service.edit({ terms: 'Testing terms' });
expect(RequestHelper.put()).toHaveBeenCalledWith(service, 'application/settings', {
terms: 'Testing terms',
});
});
});