mirror of
https://github.com/n8n-io/n8n
synced 2026-04-21 15:47:20 +00:00
fix(Google Cloud Firestore Node): Fix empty array serialization in jsonToDocument (#28213)
Some checks failed
CI: Master (Build, Test, Lint) / Build for Github Cache (push) Has been cancelled
CI: Master (Build, Test, Lint) / Unit tests (push) Has been cancelled
CI: Master (Build, Test, Lint) / Lint (push) Has been cancelled
CI: Master (Build, Test, Lint) / Performance (push) Has been cancelled
CI: Master (Build, Test, Lint) / Notify Slack on failure (push) Has been cancelled
Some checks failed
CI: Master (Build, Test, Lint) / Build for Github Cache (push) Has been cancelled
CI: Master (Build, Test, Lint) / Unit tests (push) Has been cancelled
CI: Master (Build, Test, Lint) / Lint (push) Has been cancelled
CI: Master (Build, Test, Lint) / Performance (push) Has been cancelled
CI: Master (Build, Test, Lint) / Notify Slack on failure (push) Has been cancelled
Co-authored-by: RomanDavydchuk <roman.davydchuk@n8n.io>
This commit is contained in:
parent
f1dab3e295
commit
7094395cef
2 changed files with 5 additions and 1 deletions
|
|
@ -90,7 +90,7 @@ export function jsonToDocument(value: string | number | IDataObject | IDataObjec
|
|||
return { booleanValue: value };
|
||||
} else if (value === null) {
|
||||
return { nullValue: null };
|
||||
} else if (value !== '' && !isNaN(value as number)) {
|
||||
} else if (value !== '' && typeof value !== 'object' && !isNaN(value as number)) {
|
||||
if (value.toString().indexOf('.') !== -1) {
|
||||
return { doubleValue: value };
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -344,6 +344,10 @@ describe('GoogleFirebaseCloudFirestore > GenericFunctions', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('should convert empty arrays', () => {
|
||||
expect(jsonToDocument([] as any)).toEqual({ arrayValue: { values: [] } });
|
||||
});
|
||||
|
||||
it('should handle edge cases', () => {
|
||||
expect(jsonToDocument(0)).toEqual({ integerValue: 0 });
|
||||
expect(jsonToDocument(NaN as any)).toEqual({});
|
||||
|
|
|
|||
Loading…
Reference in a new issue