Skip to content
Snippets Groups Projects
Commit 109a3580 authored by Emmanuel Raviart's avatar Emmanuel Raviart
Browse files

Don't fail when duplicating a test case

parent 079a5201
Branches
No related tags found
No related merge requests found
......@@ -23,27 +23,31 @@
function duplicateTestCaseAndCloseModal() {
shared.testCasesIndex = [shared.testCasesIndex[0], shared.testCases.length]
const duplicatedTestCase = structuredClone(
shared.testCases[shared.testCasesIndex[0]],
$state.snapshot(shared.testCases[shared.testCasesIndex[0]]),
)
duplicatedTestCase.title = `Copie de ${duplicatedTestCase.title}`
shared.testCases.push(duplicatedTestCase)
const duplicatedEvaluationByName = structuredClone(
shared.evaluationByNameArray[shared.testCasesIndex[0]],
$state.snapshot(shared.evaluationByNameArray[shared.testCasesIndex[0]]),
)
shared.evaluationByNameArray.push(duplicatedEvaluationByName)
const duplicatedInputInstantsByVariableName = structuredClone(
$state.snapshot(
shared.inputInstantsByVariableNameArray[shared.testCasesIndex[0]],
),
)
shared.inputInstantsByVariableNameArray.push(
duplicatedInputInstantsByVariableName,
)
const duplicatedValuesByCalculationNameByVariableName = structuredClone(
$state.snapshot(
shared.valuesByCalculationNameByVariableNameArray[
shared.testCasesIndex[0]
],
),
)
shared.valuesByCalculationNameByVariableNameArray.push(
duplicatedValuesByCalculationNameByVariableName,
......
......@@ -288,7 +288,7 @@
}
const originalSituation = testCasesCore[situationIndex]
for (const key in originalSituation) {
situation[key] = structuredClone(originalSituation[key])
situation[key] = structuredClone($state.snapshot(originalSituation[key]))
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment