From 073a5b94d3766102d9b652669d7fcae3064665a6 Mon Sep 17 00:00:00 2001 From: Wolkenfarmer Date: Thu, 17 Oct 2024 00:01:15 +0200 Subject: [PATCH] #335 test: adapt finishAction test to the updated finishAction test in the 330 version --- testing/backend-stress/src/finishAction.js | 17 ++++++----------- testing/backend-stress/src/main.js | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/testing/backend-stress/src/finishAction.js b/testing/backend-stress/src/finishAction.js index f6e5aad5..6252bd7d 100644 --- a/testing/backend-stress/src/finishAction.js +++ b/testing/backend-stress/src/finishAction.js @@ -24,10 +24,13 @@ async function simulate(userIndex) { }) const startTime = now(); - await doAction() + await new Promise(resolve => { + socketPatient.actionAdd(actionName, confirmed => { + if (!confirmed) throw Error("action declined") + }, () => resolve()) + }) const endTime = now(); - socketPatient.close() socketTrainer.close() @@ -64,7 +67,7 @@ async function prepareExercise() { }) await new Promise(resolve => { - socketTrainer.patientAdd(areaId, "", 1005, exercise => { + socketTrainer.patientAdd(areaId, "", 1001, exercise => { patientId = exercise.areas[0].patients[0].patientId resolve() }) @@ -82,12 +85,4 @@ async function prepareExercise() { }) } -async function doAction() { - await new Promise(resolve => { - socketPatient.actionAdd(actionName, confirmed => { - if (!confirmed) throw Error("action declined") - }, () => resolve()) - }) -} - simulate(workerData.userIndex); \ No newline at end of file diff --git a/testing/backend-stress/src/main.js b/testing/backend-stress/src/main.js index 2b342f78..d2b9a813 100644 --- a/testing/backend-stress/src/main.js +++ b/testing/backend-stress/src/main.js @@ -7,7 +7,7 @@ let workerCount = 0; function startWorker(userIndex) { return new Promise((resolve, reject) => { - const worker = new Worker('./phaseChange.js', { + const worker = new Worker('./finishAction.js', { workerData: { userIndex } });