mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-15 12:23:51 +00:00
V2 e2e (#320)
* chore: cleanup handling of a bad read * chore: configure e2e testing * chore: version bump
This commit is contained in:
@@ -64,9 +64,6 @@ app.use('/playback', playbackRouter);
|
||||
app.use('/external', express.static(join(currentDirectory, 'external')));
|
||||
|
||||
// serve static - react, in test mode we fetch the React app from module
|
||||
const newpath = join(currentDirectory, resolvedPath());
|
||||
console.log('serving content at ', newpath);
|
||||
|
||||
app.use(express.static(join(currentDirectory, resolvedPath())));
|
||||
|
||||
app.get('*', (req, res) => {
|
||||
|
||||
@@ -57,6 +57,10 @@ async function loadDb() {
|
||||
const db = new Low(adapter);
|
||||
|
||||
const data = await parseDb(dbInDisk, db);
|
||||
if (data === null) {
|
||||
console.log('ERROR: Invalid JSON format');
|
||||
return;
|
||||
}
|
||||
|
||||
db.data = data;
|
||||
await db.write();
|
||||
|
||||
@@ -46,12 +46,15 @@ const devPath = '../../client/build/';
|
||||
const dockerPath = 'client/';
|
||||
|
||||
export const resolvedPath = (): string => {
|
||||
if (isProduction) {
|
||||
return productionPath;
|
||||
if (isTest) {
|
||||
return devPath;
|
||||
}
|
||||
if (isDocker) {
|
||||
return dockerPath;
|
||||
}
|
||||
if (isProduction) {
|
||||
return productionPath;
|
||||
}
|
||||
return devPath;
|
||||
};
|
||||
|
||||
|
||||
@@ -258,10 +258,9 @@ export const parseExcel = async (excelData) => {
|
||||
* @param {boolean} [enforce=false] - flag, tells to create an object anyway
|
||||
* @returns {object} - parsed object
|
||||
*/
|
||||
export const parseJson = async (jsonData, enforce = false): Promise<DatabaseModel | -1> => {
|
||||
export const parseJson = async (jsonData, enforce = false): Promise<DatabaseModel | null> => {
|
||||
if (!jsonData || typeof jsonData !== 'object') {
|
||||
console.log('ERROR: Invalid JSON format');
|
||||
return -1;
|
||||
return null;
|
||||
}
|
||||
|
||||
// object containing the parsed data
|
||||
|
||||
Reference in New Issue
Block a user