mirror of
https://github.com/jdalrymple/gitbeaker.git
synced 2026-01-18 15:55:30 +00:00
Standardizing config files
This commit is contained in:
parent
5a267d7f86
commit
b6717c76d4
@ -1,5 +0,0 @@
|
||||
coverageDirectory: "./coverage/"
|
||||
collectCoverage: true
|
||||
testRegex: "(/__tests__/.*|/tests/.*(\\.|/)(test|spec))\\.jsx?$"
|
||||
reporters:
|
||||
- "jest-tap-reporter"
|
||||
12
jest.config.js
Normal file
12
jest.config.js
Normal file
@ -0,0 +1,12 @@
|
||||
// coverageDirectory: "./coverage/"
|
||||
// collectCoverage: true
|
||||
// testRegex: "(/__tests__/.*|/tests/.*(\\.|/)(test|spec))\\.jsx?$"
|
||||
// reporters:
|
||||
// - "jest-tap-reporter"
|
||||
|
||||
{
|
||||
"coverageDirectory": "./coverage/",
|
||||
"collectCoverage": true,
|
||||
"testRegex": "(/__tests__/.*|/tests/.*(\\.|/)(test|spec))\\.jsx?$",
|
||||
"reporters": ["jest-tap-reporter" ]
|
||||
}
|
||||
29
tests/infratructure/BaseService.js
Normal file
29
tests/infratructure/BaseService.js
Normal file
@ -0,0 +1,29 @@
|
||||
import { BaseService } from '../../dist/latest/infrastructure';
|
||||
|
||||
test('If a token or oauthToken is not passed, throw an error', async ()=> {
|
||||
expect(new BaseService()).toThrowError('`token` (private-token) or `oauth_token` is mandatory')
|
||||
});
|
||||
|
||||
test('Url defaults to https://gitlab.com/api/v4', async () => {
|
||||
const service = new BaseService({token: 'test'});
|
||||
|
||||
expect(service.url).toBe('https://gitlab.com/api/v4');
|
||||
});
|
||||
|
||||
test('Custom url still appends api and version number to url', async () => {
|
||||
const service = new BaseService({url: 'https://testing.com', token: 'test'});
|
||||
|
||||
expect(service.url).toBe('https://testing.com/api/v4');
|
||||
});
|
||||
|
||||
test('Oauth token adds to authorization header as a bearer token', async () => {
|
||||
const service = new BaseService({url: 'https://testing.com', oauthToken: '1234'});
|
||||
|
||||
expect(service.headers.authorization).toBe('Bearer 1234');
|
||||
});
|
||||
|
||||
test('Private token adds to private-token header', async () => {
|
||||
const service = new BaseService({url: 'https://testing.com', token: '1234'});
|
||||
|
||||
expect(service.headers['private-token']).toBe('1234');
|
||||
});
|
||||
@ -1,29 +1,26 @@
|
||||
import Test from 'blue-tape';
|
||||
import { ApplicationSettings } from '../../dist/latest';
|
||||
// import { ApplicationSettings } from '../../dist/latest';
|
||||
|
||||
Test('Basic init of ApplicationSettings library', async (assert)=> {
|
||||
const service = new ApplicationSettings({ url: process.env.TEST_URL, token: process.env.TEST_TOKEN });
|
||||
// test('Basic init of ApplicationSettings library', async ()=> {
|
||||
// const service = new ApplicationSettings({ url: process.env.TEST_URL, token: process.env.TEST_TOKEN });
|
||||
|
||||
assert.true(true);
|
||||
});
|
||||
// assert.true(true);
|
||||
// });
|
||||
|
||||
Test('Getting all the application settings', async (assert) => {
|
||||
const service = new ApplicationSettings({ url: process.env.TEST_URL, token: process.env.TEST_TOKEN });
|
||||
const settings = await service.all();
|
||||
// test('Getting all the application settings', async () => {
|
||||
// const service = new ApplicationSettings({ url: process.env.TEST_URL, token: process.env.TEST_TOKEN });
|
||||
// const settings = await service.all();
|
||||
|
||||
// Check the settings
|
||||
assert.true(true);
|
||||
});
|
||||
// // Check the settings
|
||||
// assert.true(true);
|
||||
// });
|
||||
|
||||
Test('Edit the application settings', async (assert) => {
|
||||
const service = new ApplicationSettings({ url: process.env.TEST_URL, token: process.env.TEST_TOKEN });
|
||||
const settings = await service.edit({
|
||||
// test('Edit the application settings', async (assert) => {
|
||||
// const service = new ApplicationSettings({ url: process.env.TEST_URL, token: process.env.TEST_TOKEN });
|
||||
// const settings = await service.edit({
|
||||
|
||||
});
|
||||
// });
|
||||
|
||||
// Check the settings
|
||||
// Return to original state
|
||||
assert.true(true);
|
||||
});
|
||||
|
||||
Test.onFinish(() => process.exit(0));
|
||||
// // Check the settings
|
||||
// // Return to original state
|
||||
// assert.true(true);
|
||||
// });
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user