Initial commit
This commit is contained in:
15
tests/routers/firstRouter.test.ts
Normal file
15
tests/routers/firstRouter.test.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import request from 'supertest';
|
||||
import server from '../../src/server';
|
||||
|
||||
it('should respond to /firstroute', async () => {
|
||||
const res = await request(server).get('/firstroute');
|
||||
expect(res.statusCode).toEqual(200);
|
||||
});
|
||||
|
||||
it('should respond to /firstroute/somepath/:para/', async () => {
|
||||
const res = await request(server).get('/firstroute/somepath/myparam');
|
||||
expect(res.statusCode).toEqual(200);
|
||||
expect(res.text).toEqual(
|
||||
'Hello from First Router somePath route with param: myparam',
|
||||
);
|
||||
});
|
||||
15
tests/routers/secondRouter.test.ts
Normal file
15
tests/routers/secondRouter.test.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import request from 'supertest';
|
||||
import server from '../../src/server';
|
||||
|
||||
it('should respond to /secondroute', async () => {
|
||||
const res = await request(server).get('/secondroute');
|
||||
expect(res.statusCode).toEqual(200);
|
||||
});
|
||||
|
||||
it('should respond to /secondroute/somepath/:para/', async () => {
|
||||
const res = await request(server).get('/secondroute/somepath/myparam');
|
||||
expect(res.statusCode).toEqual(200);
|
||||
expect(res.text).toEqual(
|
||||
'Hello from Second Router somePath route with param: myparam',
|
||||
);
|
||||
});
|
||||
10
tests/server.test.js
Normal file
10
tests/server.test.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import request from 'supertest'
|
||||
import app from '../src/server'
|
||||
|
||||
describe('Express App', () => {
|
||||
it('should respond with "Application is running!" at the root', async () => {
|
||||
const res = await request(app).get('/')
|
||||
expect(res.statusCode).toEqual(200)
|
||||
expect(res.text).toBe('Application is running!')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user