-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
33 lines (26 loc) · 1.04 KB
/
test.js
File metadata and controls
33 lines (26 loc) · 1.04 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
const fs = require('fs');
const yaml = require('js-yaml');
const get_config = require("./src/config.js");
const moxios = require('moxios');
const accessToken = require('./test/mocks/AccessTokenMock');
const ill_request_response = fs.readFileSync(require('path').resolve(__dirname, 'test/mocks/illRequestResponse.json')).toString();
const error_response = fs.readFileSync(require('path').resolve(__dirname, 'test/mocks/errorResponse.json')).toString();
moxios.install();
moxios.stubOnce('POST', 'https://128807.share.worldcat.org/ILL/request/data', {
status: 200,
responseText: ill_request_response
});
moxios.stubOnce('GET', 'https://128807.share.worldcat.org/ILL/request/data/166917929', {
status: 200,
responseText: ill_request_response
});
let environment = "test";
global.config = "";
global.config = yaml.load(get_config(environment));
let app = require('./src/server.js');
app.set('accessToken', accessToken);
let port = process.env.PORT || 8000;
// Server
app.listen(port, () => {
console.log(`Listening on: http://localhost:${port}`);
});