-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.test.js
More file actions
25 lines (22 loc) · 846 Bytes
/
index.test.js
File metadata and controls
25 lines (22 loc) · 846 Bytes
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
const request = require('supertest');
const {app, server} = require('./index.js');
describe('Routes Testing', () => {
it('Root Route', async () => {
const response = await request(app).get('/');
expect(response.statusCode).toBe(200);
expect(response.text).toBe('<h1>Welcome to the Home Page!</h1>');
});
it('About Route', async () => {
const response = await request(app).get('/about');
expect(response.statusCode).toBe(200);
expect(response.text).toBe('<h1>This is the About Us Page.</h1>');
});
it('Contact Route', async () => {
const response = await request(app).get('/contact');
expect(response.statusCode).toBe(200);
expect(response.text).toBe('<h1>This is the Contact Us Page.</h1>');
});
});
afterAll(done => {
server.close(done);
});