Skip to content

Commit 825ee1a

Browse files
author
Marcus Olsson
committed
Improves Cloud.run options validation
Updates the validation logic for the options parameter in the Cloud.run function. Allows null as a valid options value, and removes null from the invalid options list. This change ensures the function correctly handles different input scenarios.
1 parent 1ff8ff2 commit 825ee1a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/__tests__/Cloud-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ describe('CloudController', () => {
357357
expect(options.useMasterKey).toBe(false);
358358
});
359359

360-
it('run passes with empty options', () => {
361-
const values = [undefined, {}];
360+
it('run passes with undefined, null or empty options', () => {
361+
const values = [undefined, null, {}];
362362

363363
const mockRun = jest.fn();
364364
mockRun.mockReturnValue(Promise.resolve({ result: {} }));
@@ -377,7 +377,7 @@ describe('CloudController', () => {
377377
});
378378

379379
it('run throws with invalid options', () => {
380-
const values = [null, []];
380+
const values = [[]];
381381
for (const value of values) {
382382
expect(() => Cloud.run('myfunction', {}, value)).toThrow();
383383
}

0 commit comments

Comments
 (0)