fix(Google Sheets Node): Get Rows operation returns an empty string when the cell has a value of 0 (#17642)

This commit is contained in:
RomanDavydchuk
2025-07-28 11:43:33 +03:00
committed by GitHub
parent e1ef35a2b4
commit 980878398e
2 changed files with 31 additions and 1 deletions

View File

@@ -122,6 +122,36 @@ describe('GoogleSheet', () => {
{ name: 'Jane', age: '25' },
]);
});
it('should handle zero values correctly', () => {
const data = [
['name', 'age'],
['John', 30],
['Jane', 0],
];
const result = googleSheet.convertSheetDataArrayToObjectArray(data, 1, ['name', 'age']);
expect(result).toEqual([
{ name: 'John', age: 30 },
{ name: 'Jane', age: 0 },
]);
});
it('should handle nullish values correctly', () => {
const data = [
['name', 'age'],
['John', null as unknown as number],
['Jane', undefined as unknown as number],
];
const result = googleSheet.convertSheetDataArrayToObjectArray(data, 1, ['name', 'age']);
expect(result).toEqual([
{ name: 'John', age: '' },
{ name: 'Jane', age: '' },
]);
});
});
describe('lookupValues', () => {

View File

@@ -334,7 +334,7 @@ export class GoogleSheet {
for (let columnIndex = 0; columnIndex < columnCount; columnIndex++) {
const key = columnKeys[columnIndex];
if (key) {
item[key] = sheet[rowIndex][columnIndex] || '';
item[key] = sheet[rowIndex][columnIndex] ?? '';
}
}