-
Notifications
You must be signed in to change notification settings - Fork 1
/
predictIt.test.js
44 lines (35 loc) · 1.5 KB
/
predictIt.test.js
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
const predictIt = require('./predictIt.js');
const assert = require('chai').assert;
const chakram = require('chakram');
const expect = chakram.expect;
describe('PredictIt is up and responding to tests', () => {
it('should respond at the /all endpoint', () => {
return chakram.get('https://www.predictit.org/api/marketdata/all');
});
const category = '13';
const categoryName = 'US Politics';
it(`should respond at the /category endpoint for the ${categoryName} category`, () => {
return chakram.get(`https://www.predictit.org/api/marketdata/category/${category}`);
});
const group = '37';
const groupName = 'White House';
it(`should respond at the /group endpoint for the ${groupName} group`, () => {
return chakram.get(`https://www.predictit.org/api/marketdata/group/${group}`);
});
const ticker = 'CHINA.MANIPULATOR.063017';
it(`should respond at the /ticker endpoint for the ${ticker} market`, () => {
return chakram.get(`https://www.predictit.org/api/marketdata/ticker/${ticker}`);
});
});
describe('Our wrapper errors out correctly with bad arguments', () => {
xit('should error properly when group doesn\'t exist', () => {
predictIt.group(889)
.then(d => console.log(d));
});
});
describe('Our API wrapper correctly pulls from each endpoint', () => {
const ticker = 'CHINA.MANIPULATOR.063017';
it(`should return json data for the ${ticker} market`, () => {
var response = chakram.get(`https://www.predictit.org/api/marketdata/ticker/${ticker}`);
});
});