Skip to content

Commit

Permalink
fix merge/unmerge tests
Browse files Browse the repository at this point in the history
  • Loading branch information
theoephraim committed Nov 27, 2020
1 parent 2b4bc7e commit 4cfc776
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/GoogleSpreadsheetWorksheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ class GoogleSpreadsheetWorksheet {
async mergeCells(range, mergeType = 'MERGE_ALL') {
// Request type = `mergeCells`
// https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#MergeCellsRequest
if (range.sheetId !== this.sheetId) {
if (range.sheetId && range.sheetId !== this.sheetId) {
throw new Error('Leave sheet ID blank or set to matching ID of this sheet');
}
await this._makeSingleUpdateRequest('mergeCells', {
Expand All @@ -571,7 +571,7 @@ class GoogleSpreadsheetWorksheet {
async unmergeCells(range) {
// Request type = `unmergeCells`
// https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#UnmergeCellsRequest
if (range.sheetId !== this.sheetId) {
if (range.sheetId && range.sheetId !== this.sheetId) {
throw new Error('Leave sheet ID blank or set to matching ID of this sheet');
}
await this._makeSingleUpdateRequest('unmergeCells', {
Expand Down
3 changes: 3 additions & 0 deletions test/rows.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ describe('Row-based operations', () => {
});
});

// TODO: Move to cells.test.js because mergeCells and unmergeCells are really cell operations
// but they were implemented using the existing data we have here in the rows tests
// so we'll leave them here for now
describe('merge and unmerge operations', () => {
beforeAll(async () => {
await sheet.loadCells('A1:H2');
Expand Down

0 comments on commit 4cfc776

Please sign in to comment.