mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
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:
@@ -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', () => {
|
||||
|
||||
@@ -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] ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user