({ stepNum, stepId }: InsertOptions)
| 150 | } |
| 151 | |
| 152 | async function insertStepIntoMeta({ stepNum, stepId }: InsertOptions) { |
| 153 | const existingMeta = getMetaData(); |
| 154 | const oldOrder = [...existingMeta.challengeOrder]; |
| 155 | |
| 156 | oldOrder.splice(stepNum - 1, 0, { id: stepId.toString(), title: '' }); |
| 157 | // rename all the files in challengeOrder |
| 158 | const challengeOrder = oldOrder.map(({ id }, index) => ({ |
| 159 | id, |
| 160 | title: `Step ${index + 1}` |
| 161 | })); |
| 162 | |
| 163 | await updateMetaData({ ...existingMeta, challengeOrder }); |
| 164 | } |
| 165 | |
| 166 | async function deleteStepFromMeta({ stepNum }: { stepNum: number }) { |
| 167 | const existingMeta = getMetaData(); |
no test coverage detected