diff --git a/packages/functions/__tests__/functions.test.ts b/packages/functions/__tests__/functions.test.ts index 62f0f7cbcf..0cae6ce247 100644 --- a/packages/functions/__tests__/functions.test.ts +++ b/packages/functions/__tests__/functions.test.ts @@ -1,6 +1,12 @@ import { describe, expect, it } from '@jest/globals'; -import functions, { firebase } from '../lib'; +import functions, { + firebase, + getFunctions, + connectFunctionsEmulator, + httpsCallable, + httpsCallableFromUrl, +} from '../lib'; describe('Cloud Functions', function () { describe('namespace', function () { @@ -46,4 +52,22 @@ describe('Cloud Functions', function () { ); }); }); + + describe('modular', function () { + it('`getFunctions` function is properly exposed to end user', function () { + expect(getFunctions).toBeDefined(); + }); + + it('`connectFunctionsEmulator` function is properly exposed to end user', function () { + expect(connectFunctionsEmulator).toBeDefined(); + }); + + it('`httpsCallable` function is properly exposed to end user', function () { + expect(httpsCallable).toBeDefined(); + }); + + it('`httpsCallableFromUrl` function is properly exposed to end user', function () { + expect(httpsCallableFromUrl).toBeDefined(); + }); + }); }); diff --git a/packages/functions/lib/index.d.ts b/packages/functions/lib/index.d.ts index e1308bfc9f..9d8092e483 100644 --- a/packages/functions/lib/index.d.ts +++ b/packages/functions/lib/index.d.ts @@ -427,6 +427,8 @@ export const firebase: ReactNativeFirebase.Module & { export default defaultExport; +export * from './modular'; + /** * Attach namespace to `firebase.` and `FirebaseApp.`. */ diff --git a/packages/functions/lib/index.js b/packages/functions/lib/index.js index e3f8d82573..0175b2c6a7 100644 --- a/packages/functions/lib/index.js +++ b/packages/functions/lib/index.js @@ -29,13 +29,6 @@ import fallBackModule from './web/RNFBFunctionsModule'; const namespace = 'functions'; const nativeModuleName = 'RNFBFunctionsModule'; -export { - getFunctions, - httpsCallable, - httpsCallableFromUrl, - connectFunctionsEmulator, -} from './modular/index'; - export const HttpsErrorCode = { OK: 'ok', CANCELLED: 'cancelled', @@ -207,6 +200,8 @@ export default createModuleNamespace({ ModuleClass: FirebaseFunctionsModule, }); +export * from './modular'; + // import functions, { firebase } from '@react-native-firebase/functions'; // functions().logEvent(...); // firebase.functions().logEvent(...); diff --git a/packages/functions/lib/modular/index.d.ts b/packages/functions/lib/modular/index.d.ts index 7bb551ac1c..538dbd5c61 100644 --- a/packages/functions/lib/modular/index.d.ts +++ b/packages/functions/lib/modular/index.d.ts @@ -45,7 +45,7 @@ export declare function httpsCallable( +export declare function httpsCallableFromUrl( functionsInstance: Functions, url: string, options?: HttpsCallableOptions, diff --git a/packages/functions/lib/modular/index.js b/packages/functions/lib/modular/index.js index 700cd2bba9..15683ebf9a 100644 --- a/packages/functions/lib/modular/index.js +++ b/packages/functions/lib/modular/index.js @@ -43,6 +43,7 @@ export function getFunctions(app, regionOrCustomDomain) { * @param {Functions} functionsInstance A functions instance. * @param {string} host The emulator host. (ex: localhost) * @param {number} port The emulator port. (ex: 5001) + * @returns {void} */ export function connectFunctionsEmulator(functionsInstance, host, port) { return firebase