Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export function run<
T extends (param: { [P in keyof Parameters<T>[0]]: Parameters<T>[0][P] }) => any,
>(name: string, data: Parameters<T>[0], options?: RequestOptions): Promise<ReturnType<T>>;
export function run(name: string, data?: any, options?: RequestOptions): Promise<any> {
options = options || {};
if (typeof name !== 'string' || name.length === 0) {
throw new TypeError('Cloud function name must be a string.');
}
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/Cloud-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ describe('CloudController', () => {
expect(options.useMasterKey).toBe(false);
});

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

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

it('run throws with invalid options', () => {
const values = [null, []];
const values = [[]];
for (const value of values) {
expect(() => Cloud.run('myfunction', {}, value)).toThrow();
}
Expand Down