mirror of
https://gitlab.com/RemixDev/deemix-gui.git
synced 2024-12-29 11:06:13 +00:00
fix(server): login-arl tests [skip ci]
This commit is contained in:
parent
a9fe54eb72
commit
d574d96885
|
@ -28,13 +28,13 @@ describe('login-arl requests', () => {
|
|||
const response = await appSendPost(`/api/login-arl/?arl=${process.env.DEEZER_ARL}`)
|
||||
|
||||
expect(response.status).toBe(200)
|
||||
expect(response.body).toBe(true)
|
||||
expect(response.body.status).toBe(true)
|
||||
})
|
||||
|
||||
it('should not login using wrong ARL', async () => {
|
||||
const response = await appSendPost(`/api/login-arl/?arl=abcdef1234`)
|
||||
|
||||
expect(response.status).toBe(200)
|
||||
expect(response.body).toBe(false)
|
||||
expect(response.body.status).toBe(false)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -24,13 +24,11 @@ const handler: RequestHandler<{}, {}, {}, RawLoginArlQuery> = async (req, res, n
|
|||
const dz = sessionDZ[req.session.id]
|
||||
|
||||
if (!req.query) {
|
||||
res.status(400).send()
|
||||
return next()
|
||||
return res.status(400).send()
|
||||
}
|
||||
|
||||
if (!req.query.arl) {
|
||||
res.status(400).send()
|
||||
return next()
|
||||
return res.status(400).send()
|
||||
}
|
||||
|
||||
const loginParams: (string | number)[] = [req.query.arl]
|
||||
|
@ -54,12 +52,10 @@ const handler: RequestHandler<{}, {}, {}, RawLoginArlQuery> = async (req, res, n
|
|||
const testDz = new Deezer()
|
||||
response = await testDz.login_via_arl(...loginParams)
|
||||
}
|
||||
console.log(response)
|
||||
const returnValue = { status: response, arl: req.query.arl, user: dz.current_user }
|
||||
|
||||
res.status(200).send(returnValue)
|
||||
startQueue(dz)
|
||||
next()
|
||||
return res.status(200).send(returnValue)
|
||||
}
|
||||
|
||||
const apiHandler = { path, handler }
|
||||
|
|
Loading…
Reference in a new issue