Skip to content

Commit

Permalink
Fix RUTv2 compat instances not working with modular. (#5500)
Browse files Browse the repository at this point in the history
* Fix RUTv2 compat instances not working with modular.

* Create fast-brooms-tie.md
  • Loading branch information
yuchenshi committed Sep 16, 2021
1 parent 07b88e6 commit 46d26ff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/fast-brooms-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/rules-unit-testing": patch
---

Fix typing issues where Database/Firestore/Storage compat instances returned by RulesTestContext are not compatible with v9 modular APIs.
6 changes: 6 additions & 0 deletions packages/rules-unit-testing/src/public_types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
import { FirebaseSignInProvider } from '@firebase/util';
import firebase from 'firebase/compat/app';

// These import statements allow v9 compat instances (created by RulesTestContext) to be used in v9
// modular APIs, e.g. `doc(context.firestore(), 'a/b')` in developer code. (a.k.a. "interop mode".)
import 'firebase/compat/database';
import 'firebase/compat/firestore';
import 'firebase/compat/storage';

/**
* More options for the mock user token to be used for testing, including developer-specfied custom
* claims or optional overrides for Firebase Auth token payloads.
Expand Down

0 comments on commit 46d26ff

Please sign in to comment.