Repository navigation
Expand file tree
/
Copy pathsupertest.js
More file actions
73 lines (71 loc) · 2.36 KB
/
Copy pathsupertest.js
File metadata and controls
73 lines (71 loc) · 2.36 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
62
63
64
65
66
67
68
69
70
71
72
73
const request = require('supertest');
const server = 'http://localhost:3000';
/**************************** Route Integration testing *********************/
// Test if main route successfully serves our html file
describe('Route integration', () => {
describe('/', () => {
describe('GET', () => {
it('responds with 200 status and serves static html file', () => {
return request(server)
.get('/')
.expect('Content-Type', /text\/html/)
.expect(200);
});
});
});
});
// Test if visualizer route successfully serves our html file
/*****TODO*****: Update to check if the div with id datapage is served */
describe('Route integration', () => {
describe('/data', () => {
describe('GET', () => {
it('responds with 200 status and serves static html file', () => {
return request(server)
.get('/')
.expect('Content-Type', /text\/html/)
.expect(200);
});
});
});
});
// Test if status 404 and 'Not Found' is sent when route does not exist
describe('Route integration', () => {
describe('/nosuchroute', () => {
describe('GET', () => {
it('responds with 404 status and Not Found', () => {
return request(server)
.get('/nosuchroute')
.expect('Content-Type', /text\/html/)
.expect(404, 'Not Found');
});
});
});
});
// Test if route to get example schema has status 200 and content type is json
/*****TODO*****: Update to check the contents of the response body for the schema */
describe('Route integration', () => {
describe('/example-schema', () => {
describe('GET', () => {
it('responds with 200 status, Content-Type is /json ', () => {
return request(server)
.get('/example-schema')
.expect('Content-Type', /json/)
.expect(200);
});
});
});
});
//Test if route to get users db schema from their inputted psql_uri has status 200 and content type is json
/*****TODO*****: Update to check the contents of the response body for the schema */
describe('Route integration', () => {
describe('/sql-schema', () => {
describe('POST', () => {
it('responds with 200 status, Content-Type is application/json ', () => {
return request(server)
.post('/sql-schema')
.expect('Content-Type', /json/)
.expect(200);
});
});
});
});