Small fix to googlesheets mock.

This commit is contained in:
Sam Rose 2025-03-04 10:14:41 +00:00
parent 2c43740500
commit 7f4779aad5
No known key found for this signature in database
1 changed files with 6 additions and 5 deletions

View File

@ -420,15 +420,16 @@ export class GoogleSheetsMock {
} }
const newRows = body.values.map(v => this.valuesToRowData(v)) const newRows = body.values.map(v => this.valuesToRowData(v))
const toDelete = const newMetadata = newRows.map(() => ({
params.insertDataOption === "INSERT_ROWS" ? newRows.length : 0
sheet.data[0].rowData.splice(endRowIndex + 1, toDelete, ...newRows)
sheet.data[0].rowMetadata.splice(endRowIndex + 1, toDelete, {
hiddenByUser: false, hiddenByUser: false,
hiddenByFilter: false, hiddenByFilter: false,
pixelSize: 100, pixelSize: 100,
developerMetadata: [], developerMetadata: [],
}) }))
const toDelete =
params.insertDataOption === "INSERT_ROWS" ? newRows.length : 0
sheet.data[0].rowData.splice(endRowIndex + 1, toDelete, ...newRows)
sheet.data[0].rowMetadata.splice(endRowIndex + 1, toDelete, ...newMetadata)
// It's important to give back a correct updated range because the API // It's important to give back a correct updated range because the API
// library we use makes use of it to assign the correct row IDs to rows. // library we use makes use of it to assign the correct row IDs to rows.