Skip to content

Commit

Permalink
(add) test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
NemesisX1 committed Oct 18, 2023
1 parent 2d69a9b commit 17405b9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "sh etc/build.sh",
"prod": "npm build && cd dist && npm i && node bin/www.js",
"docs": "ts-node src/swagger.ts",
"test": "jest --collect-coverage --detectOpenHandles"
"test": "jest --collect-coverage"
},
"dependencies": {
"@types/jest": "^29.5.5",
Expand Down
21 changes: 10 additions & 11 deletions src/tests/api/theaters-route.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,21 @@ import request from 'supertest';

describe('Testing theaters routes', () => {

afterAll(() => {
exit(0);
})
const reqApp = request(app);

test('if /GET is working', async () => {

const res = await request(app).get('/');
const res = await reqApp.get('/');


expect(res.statusCode).toBe(200);

});


test('if /GET theaters/names is working', async () => {

const res = await request(app).get('/theaters/names');
const res = await reqApp.get('/theaters/names');

expect(res.statusCode).toBe(200);

Expand All @@ -29,7 +28,7 @@ describe('Testing theaters routes', () => {

test('if /GET theaters/movies/ is working', async () => {

const res = await request(app).get('/theaters/movies/wologuede');
const res = await reqApp.get('/theaters/movies/wologuede');

expect(res.statusCode).toBe(200);

Expand All @@ -38,7 +37,7 @@ describe('Testing theaters routes', () => {

test('if /GET theaters/movies/ is working with lang en', async () => {

const res = await request(app).get('/theaters/movies/wologuede?lang=en');
const res = await reqApp.get('/theaters/movies/wologuede?lang=en');

expect(res.statusCode).toBe(200);

Expand All @@ -47,7 +46,7 @@ describe('Testing theaters routes', () => {

test('if /GET theaters/movies/ with bad theater name is not working', async () => {

const res = await request(app).get('/theaters/movies/123');
const res = await reqApp.get('/theaters/movies/123');

expect(res.statusCode).not.toBe(200);

Expand All @@ -56,7 +55,7 @@ describe('Testing theaters routes', () => {

test('if /GET theaters/movies/ with bad lang is not working', async () => {

const res = await request(app).get('/theaters/movies/wologuede?lang=zk');
const res = await reqApp.get('/theaters/movies/wologuede?lang=zk');

expect(res.statusCode).not.toBe(200);

Expand All @@ -65,7 +64,7 @@ describe('Testing theaters routes', () => {

test('if /GET theaters/movie-infos/ is working', async () => {

const res = await request(app).get('/theaters/movie-infos/banel-adama');
const res = await reqApp.get('/theaters/movie-infos/banel-adama');

expect(res.statusCode).toBe(200);

Expand All @@ -74,7 +73,7 @@ describe('Testing theaters routes', () => {

test('if /GET theaters/movie-infos/ is working with lang en', async () => {

const res = await request(app).get('/theaters/movie-infos/banel-adama?lang=en');
const res = await reqApp.get('/theaters/movie-infos/banel-adama?lang=en');

expect(res.statusCode).toBe(200);

Expand Down

0 comments on commit 17405b9

Please sign in to comment.