V2 e2e playwright (#343)

* test: create utility for uploading test-db

* chore: upgrade deps

* refactor: remove unused functions

* chore: create testing boilerplate

* test: upload showfile
This commit is contained in:
Carlos Valente
2023-04-18 23:16:19 +02:00
committed by GitHub
parent f248b78945
commit b228020b73
11 changed files with 378 additions and 42 deletions
+4 -4
View File
@@ -213,13 +213,13 @@ export const shutdown = async (exitCode = 0) => {
process.on('exit', (code) => console.log(`Ontime exited with code: ${code}`));
process.on('unhandledRejection', async () => {
logger.error('SERVER', 'Error: unhandled rejection');
process.on('unhandledRejection', async (error) => {
logger.error('SERVER', `Error: unhandled rejection ${error}`);
await shutdown(1);
});
process.on('uncaughtException', async () => {
logger.error('SERVER', 'Error: uncaught exception');
process.on('uncaughtException', async (error) => {
logger.error('SERVER', `Error: uncaught exception ${error}`);
await shutdown(1);
});
@@ -288,13 +288,3 @@ export const dbUpload = async (req, res) => {
const file = req.file.path;
await uploadAndParse(file, req, res, options);
};
// Create controller for POST request to '/ontime/dbpath'
// Returns -
export const dbPathToUpload = async (req, res) => {
if (!req.body.path) {
res.status(400).send({ message: 'Path to file not found' });
return;
}
await uploadAndParse(req.body.path, req, res);
};
+3 -7
View File
@@ -2,7 +2,6 @@ import express from 'express';
import { uploadFile } from '../utils/upload.js';
import {
dbDownload,
dbPathToUpload,
dbUpload,
getAliases,
getInfo,
@@ -19,11 +18,11 @@ import {
} from '../controllers/ontimeController.js';
import {
viewValidator,
validateAliases,
validateUserFields,
validateSettings,
validateOSC,
validateSettings,
validateUserFields,
viewValidator,
} from '../controllers/ontimeController.validate.js';
export const router = express.Router();
@@ -69,6 +68,3 @@ router.get('/osc', getOSC);
// create route between controller and '/ontime/osc' endpoint
router.post('/osc', validateOSC, postOSC);
// create route between controller and '/ontime/dbpath' endpoint
router.post('/dbpath', dbPathToUpload);