Skip to content

Commit

Permalink
fix(app-factory.js): remove undeeded csurf middleware
Browse files Browse the repository at this point in the history
As we have state csurf middleware is not needed

fix #169
  • Loading branch information
christian-hawk committed Dec 5, 2020
1 parent 7ea2c41 commit 2b2152f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
2 changes: 0 additions & 2 deletions server/app-factory.js
Expand Up @@ -9,7 +9,6 @@ const morgan = require('morgan')
const logger = require('./utils/logging')
const routes = require('./routes')
const metricsMiddleware = require('../server/utils/metrics')
// const csurf = require('csurf')
const { randomSecret } = require('./utils/misc')

class AppFactory {
Expand All @@ -19,7 +18,6 @@ class AppFactory {
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))
app.use(cookieParser())
// app.use(csurf({ cookie: true }))

app.use(session({
cookie: {
Expand Down
30 changes: 0 additions & 30 deletions test/app-factory.test.js
Expand Up @@ -26,33 +26,3 @@ function assertCalledWithFunctionAsArg (spyFn, argFn) {
assert(foundMatch === true,
'Spy function/method was not called with expected function')
}

// describe('csurf middleware', () => {
// const rewiredCsurf = appFactoryRewire.__get__('csurf')

// it('should exist', () => {
// // eslint-disable-next-line security/detect-non-literal-fs-filename
// assert.exists(rewiredCsurf)
// })

// it('should be a function', () => {
// assert.isFunction(rewiredCsurf)
// })

// it('should be equal csurf module', () => {
// assert.strictEqual(rewiredCsurf, require('csurf'))
// })

// it('should be called once as app.use arg', () => {
// const csurf = require('csurf')
// const app = appFactoryRewire.__get__('app')
// const AppFactory = appFactoryRewire.__get__('AppFactory')
// const appUseSpy = sinon.spy(app, 'use')
// const appInstance = new AppFactory()

// appInstance.createApp()

// assertCalledWithFunctionAsArg(appUseSpy, csurf({ cookies: true }))
// sinon.restore()
// })
// })

0 comments on commit 2b2152f

Please sign in to comment.