Skip to content

Commit

Permalink
changed myPageController to pageController
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGoodall committed Dec 6, 2023
1 parent bf9be40 commit 9d347d1
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import hmpoFormWizard from 'hmpo-form-wizard'
import logger from '../utils/logger.js'
const { Controller } = hmpoFormWizard

class MyPageController extends Controller {
class PageController extends Controller {
locals (req, res, callback) {
req.form.options.lastPage = req.journeyModel.get('lastVisited')
super.locals(req, res, callback)
Expand All @@ -20,4 +20,4 @@ class MyPageController extends Controller {
}
}

export default MyPageController
export default PageController
4 changes: 2 additions & 2 deletions src/controllers/datasetController.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict'

import MyPageController from './MyPageController.js'
import PageController from './PageController.js'

// ToDo: we shouldn't hardcode these values here, should we get them from the API
// maybe take from specification
import { dataSubjects } from '../utils/utils.js'

class DatasetController extends MyPageController {
class DatasetController extends PageController {
get (req, res, next) {
// const dataset = req.sessionModel.get('data-subject')
// const options = datasetOptions[dataset]
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/errorsController.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict'

import MyPageController from './MyPageController.js'
import PageController from './PageController.js'

import { severityLevels, dataSubjects } from '../utils/utils.js'

class ErrorsController extends MyPageController {
class ErrorsController extends PageController {
get (req, res, next) {
const validationResult = req.sessionModel.get('validationResult')

Expand Down
4 changes: 2 additions & 2 deletions src/controllers/uploadController.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import multer from 'multer'
import axios from 'axios'
import { readFile } from 'fs/promises'
import { lookup } from 'mime-types'
import MyPageController from './MyPageController.js'
import PageController from './PageController.js'
import config from '../../config/index.js'

import { severityLevels } from '../utils/utils.js'
Expand All @@ -13,7 +13,7 @@ const upload = multer({ dest: 'uploads/' })

const apiRoute = config.api.url + config.api.validationEndpoint

class UploadController extends MyPageController {
class UploadController extends PageController {
middlewareSetup () {
super.middlewareSetup()
this.use('/upload', upload.single('datafile'))
Expand Down
4 changes: 2 additions & 2 deletions src/routes/form-wizard/steps.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import MyPageController from '../../controllers/MyPageController.js'
import PageController from '../../controllers/PageController.js'
import datasetController from '../../controllers/datasetController.js'
import uploadController from '../../controllers/uploadController.js'
import errorsController from '../../controllers/errorsController.js'

const baseSettings = {
controller: MyPageController,
controller: PageController,
editable: true,
editBackStep: 'check'
}
Expand Down
6 changes: 3 additions & 3 deletions test/unit/MyController.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import MyPageController from '../../src/controllers/MyPageController.js'
import PageController from '../../src/controllers/PageController.js'

import { describe, it, vi, expect } from 'vitest'

import logger from '../../src/utils/logger.js'

describe('MyPageController', () => {
describe('PageController', () => {
const loggerInfoMock = vi.fn()

vi.mock('../utils/logger.js', () => {
Expand All @@ -21,7 +21,7 @@ describe('MyPageController', () => {
sessionID: '123',
ip: '1234'
}
const pageController = new MyPageController({
const pageController = new PageController({
route: '/dataset'
})
// pageController.super.get = vi.fn();
Expand Down

0 comments on commit 9d347d1

Please sign in to comment.