Repository navigation
Expand file tree
/
Copy pathendpoint.test.js
More file actions
61 lines (47 loc) · 2 KB
/
Copy pathendpoint.test.js
File metadata and controls
61 lines (47 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import {getEndpoint} from '../../lib/models/endpoint';
describe('Endpoint', function() {
describe('on dotcom', function() {
let dotcom;
beforeEach(function() {
dotcom = getEndpoint('github.com');
});
it('identifies the GraphQL resource URI', function() {
assert.strictEqual(dotcom.getGraphQLRoot(), 'https://api.github.com/graphql');
});
it('identifies the REST base resource URI', function() {
assert.strictEqual(dotcom.getRestRoot(), 'https://api.github.com');
assert.strictEqual(dotcom.getRestURI(), 'https://api.github.com');
});
it('joins additional path segments to a REST URI', function() {
assert.strictEqual(dotcom.getRestURI('sub', 're?source'), 'https://api.github.com/sub/re%3Fsource');
});
it('accesses the hostname', function() {
assert.strictEqual(dotcom.getHost(), 'github.com');
});
it('accesses a login model account', function() {
assert.strictEqual(dotcom.getLoginAccount(), 'https://api.github.com');
});
});
describe('an enterprise instance', function() {
let enterprise;
beforeEach(function() {
enterprise = getEndpoint('github.horse');
});
it('identifies the GraphQL resource URI', function() {
assert.strictEqual(enterprise.getGraphQLRoot(), 'https://github.horse/api/v3/graphql');
});
it('identifies the REST base resource URI', function() {
assert.strictEqual(enterprise.getRestRoot(), 'https://github.horse/api/v3');
assert.strictEqual(enterprise.getRestURI(), 'https://github.horse/api/v3');
});
it('joins additional path segments to the REST URI', function() {
assert.strictEqual(enterprise.getRestURI('sub', 're?source'), 'https://github.horse/api/v3/sub/re%3Fsource');
});
it('accesses the hostname', function() {
assert.strictEqual(enterprise.getHost(), 'github.horse');
});
it('accesses a login model key', function() {
assert.strictEqual(enterprise.getLoginAccount(), 'https://github.horse');
});
});
});