Skip to content

Commit

Permalink
test: remove unused tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mantariksh committed Nov 19, 2020
1 parent 09d70b8 commit 88c946f
Showing 1 changed file with 0 additions and 64 deletions.
64 changes: 0 additions & 64 deletions tests/unit/backend/controllers/spcp.server.controller.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,70 +164,6 @@ describe('SPCP Controller', () => {
}
}

describe('isSpcpAuthenticated', () => {
let next

beforeEach(() => {
req = {
form: { authType: 'SP' },
cookies: { jwtSp: 'spCookie' },
headers: {},
ip: '127.0.0.1',
get: (key) => this[key],
}
next = jasmine.createSpy()
})

const replyWith = (error, data) => {
singPassAuthClient.verifyJWT.and.callFake((jwt, cb) => {
expect(jwt).toEqual('spCookie')
cb(error, data)
})
}

const passThroughWith = (data) => {
next = jasmine.createSpy().and.callFake(() => {
expect(res.locals.uinFin).toEqual(data.userName)
expect(res.locals.userInfo).toEqual(data.userInfo)
})
}

it('should call next if authType undefined', () => {
req.form.authType = ''
Controller.isSpcpAuthenticated(authClients)(req, res, next)
expect(next).toHaveBeenCalled()
})

it('should call next if authType is NIL', () => {
req.form.authType = 'NIL'
Controller.isSpcpAuthenticated(authClients)(req, res, next)
expect(next).toHaveBeenCalled()
})

it('should return 401 if verify returns error', () => {
replyWith('error', {})
Controller.isSpcpAuthenticated(authClients)(req, res, next)
expect(next).not.toHaveBeenCalled()
expectResponse(StatusCodes.UNAUTHORIZED, {
message: 'User is not SPCP authenticated',
spcpSubmissionFailure: true,
})
})

it('should call next and set username if verify succeeds', () => {
replyWith(null, {
userName: '123',
userInfo: 'abc',
})
passThroughWith({
userName: '123',
userInfo: 'abc',
})
Controller.isSpcpAuthenticated(authClients)(req, res, next)
expect(next).toHaveBeenCalled()
})
})

describe('singPassLogin/corpPassLogin - validation', () => {
let spB64Artifact
let expectedRelayState
Expand Down

0 comments on commit 88c946f

Please sign in to comment.