Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove info files from github request app #7

Merged
merged 3 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

The GitHub request application is a tool designed to streamline and automate the process of managing and tracking request for GitHub. This includes the adding, removal or editing of members.

Each page or user interface, defined by an endpoint, is devided into three components (MVC) and as a best practice the names for the model, view and controller have, when possible, the same start name of the endpoints (e.g. for the `/info` page we have the: `info.controller.ts` and `info.html` files if models are present we would have `info.model.ts`)
Mouhajer-CO marked this conversation as resolved.
Show resolved Hide resolved

### The View

We use `Nunjucks` and `GDS` style/components.
Expand Down
5 changes: 1 addition & 4 deletions src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@ export const PATH_SSL_CERTIFICATE = process.env['PATH_SSL_CERTIFICATE'] || '';
export const SERVICE_NAME = 'Node Prototype';

// Template
export const LANDING_PAGE = 'info';
export const NOT_FOUND = 'page-not-found';
export const ERROR_PAGE = 'error';
export const CONFIRMATION = 'confirmation';

// Routing paths
export const LANDING_URL = '/info';

export const INFO_URL = '/info';
export const HEALTHCHECK_URL = '/healthcheck';
export const CONFIRMATION_URL = '/confirmation';
export const SERVICE_URL = `${BASE_URL}${LANDING_URL}`;
export const SERVICE_URL = `${BASE_URL}${CONFIRMATION_URL}`;

10 changes: 0 additions & 10 deletions src/controller/info.controller.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import { Router } from 'express';

import { logger } from '../middleware/logger.middleware';
import healthcheckRouter from './healthcheck';
import infoRouter from './info';
import confirmationRouter from './confirmation';

const router = Router();

router.use(logger);
router.use(healthcheckRouter);
router.use(infoRouter);
router.use(confirmationRouter);

export default router;
11 changes: 0 additions & 11 deletions src/routes/info.ts

This file was deleted.

7 changes: 0 additions & 7 deletions src/views/info.html

This file was deleted.

8 changes: 4 additions & 4 deletions test/integration/controller/error.spec.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
jest.mock('../../../src/controller/info.controller');
jest.mock('../../../src/controller/confirmation.controller');
jest.mock('../../../src/utils/logger');

import { jest, beforeEach, describe, expect, test } from '@jest/globals';
import request from 'supertest';

import app from '../../../src/app';
import * as config from '../../../src/config';
import * as infoController from '../../../src/controller/info.controller';
import * as confirmationController from '../../../src/controller/confirmation.controller';
import {
MOCK_NOT_FOUND_RESPONSE,
MOCK_ERROR_MESSAGE,
MOCK_SERVICE_UNAVAILABLE,
MOCK_WRONG_URL
} from '../../mock/text.mock';

const mockGet = infoController.get as jest.Mock;
const mockGet = confirmationController.get as jest.Mock;

describe('Error integration tests', () => {
beforeEach(() => {
Expand All @@ -32,7 +32,7 @@ describe('Error integration tests', () => {
mockGet.mockImplementationOnce(() => {
throw new Error(MOCK_ERROR_MESSAGE);
});
const res = await request(app).get(config.LANDING_URL);
const res = await request(app).get(config.CONFIRMATION_URL);

expect(res.status).toEqual(500);
expect(res.text).toContain(MOCK_SERVICE_UNAVAILABLE);
Expand Down
39 changes: 0 additions & 39 deletions test/integration/routes/info.spec.ts

This file was deleted.

2 changes: 0 additions & 2 deletions test/mock/text.mock.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export const MOCK_GET_INFO_RESPONSE = 'Placeholder - Info Page';
export const MOCK_POST_INFO_RESPONSE = 'post request test';
export const MOCK_OK_RESPONSE = 'OK';
export const MOCK_GET_CONFIRMATION_RESPONSE = 'GitHub request complete';
export const MOCK_NOT_FOUND_RESPONSE = 'Page not found';
Expand Down
39 changes: 0 additions & 39 deletions test/unit/controller/info.controller.spec.ts

This file was deleted.