Skip to content

Commit

Permalink
test(ml): ensure modular API are exported properly (#7938)
Browse files Browse the repository at this point in the history
  • Loading branch information
russellwheatley authored Jul 30, 2024
1 parent 275f23a commit 10d8fca
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
19 changes: 19 additions & 0 deletions packages/ml/__tests__/ml.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { describe, expect, it } from '@jest/globals';

import { firebase, getML } from '../lib';

describe('ml()', function () {
describe('namespace', function () {
it('accessible from firebase.app()', function () {
const app = firebase.app();
expect(app.ml).toBeDefined();
expect(app.ml().app).toEqual(app);
});
});

describe('modular', function () {
it('`getML` function is properly exposed to end user', function () {
expect(getML).toBeDefined();
});
});
});
2 changes: 2 additions & 0 deletions packages/ml/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export const firebase: ReactNativeFirebase.Module & {

export default defaultExport;

export * from './modular';

/**
* Attach namespace to `firebase.` and `FirebaseApp.`.
*/
Expand Down
3 changes: 1 addition & 2 deletions packages/ml/lib/modular/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ReactNativeFirebase } from '@react-native-firebase/app';
import { FirebaseApp } from '@firebase/app-types';
import { FirebaseMLTypes } from '..';

type FirebaseApp = ReactNativeFirebase.Module;
type FirebaseML = FirebaseMLTypes.Module;

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/ml/lib/modular/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { firebase } from '..';

/**
* @typedef {import('@react-native-firebase/app').ReactNativeFirebase.Module} FirebaseApp
* @typedef {import('@firebase/app').FirebaseApp} FirebaseApp
* @typedef {import('..').FirebaseMLTypes.Module} FirebaseML
*/

Expand Down

0 comments on commit 10d8fca

Please sign in to comment.