Skip to content

Commit

Permalink
#335 test: adapt finishAction test to the updated finishAction test i…
Browse files Browse the repository at this point in the history
…n the 330 version
  • Loading branch information
Wolkenfarmer committed Oct 16, 2024
1 parent fcf6e05 commit 073a5b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
17 changes: 6 additions & 11 deletions testing/backend-stress/src/finishAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()
})
Expand All @@ -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);
2 changes: 1 addition & 1 deletion testing/backend-stress/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
});

Expand Down

0 comments on commit 073a5b9

Please sign in to comment.