feat(home-server): add activating premium features during an e2e test suite run

This commit is contained in:
Karol Sójko
2023-07-13 10:58:35 +02:00
parent 2396053bc1
commit 2f0903e0eb
2 changed files with 13 additions and 0 deletions
+1
View File
@@ -1,5 +1,6 @@
LOG_LEVEL=debug
NODE_ENV=development
E2E_TESTING=false
JWT_SECRET=
AUTH_JWT_SECRET=
@@ -138,6 +138,18 @@ export class HomeServer implements HomeServerInterface {
Disallow: '/',
}),
)
if (env.get('E2E_TESTING', true) === 'true') {
app.post('/e2e/activate-premium', (request: Request, response: Response) => {
void this.activatePremiumFeatures(request.body.username).then((result) => {
if (result.isFailed()) {
response.status(400).send({ error: { message: result.getError() } })
} else {
response.status(200).send({ message: result.getValue() })
}
})
})
}
})
const logger: winston.Logger = winston.loggers.get('home-server')