Skip to content

Commit eaebcf7

Browse files
committed
build(deps): forward port to new @firebase/rules-unit-testing API
1 parent 2528262 commit eaebcf7

File tree

4 files changed

+387
-195
lines changed

4 files changed

+387
-195
lines changed

packages/database/e2e/helpers.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ exports.seed = function seed(path) {
3939
firebase.database().ref(`${path}/types`).set(CONTENT.TYPES),
4040
firebase.database().ref(`${path}/query`).set(CONTENT.QUERY),
4141
// The database emulator does not load rules correctly. We force them pre-test.
42-
testingUtils.loadDatabaseRules({ databaseName: DB_NAME, rules: DB_RULES }),
42+
testingUtils.initializeTestEnvironment({
43+
projectId: 'react-native-firebase-testing',
44+
database: { databaseName: DB_NAME, rules: DB_RULES, host: 'localhost', port: 9000 },
45+
}),
4346
]);
4447
};
4548

packages/storage/e2e/helpers.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ const WRITE_ONLY_NAME = 'writeOnly.txt';
99

1010
exports.seed = async function seed(path) {
1111
// Force the rules for the storage emulator to be what we expect
12-
await testingUtils.loadStorageRules({
13-
rules: `rules_version = '2';
12+
13+
testingUtils.initializeTestEnvironment({
14+
projectId: 'react-native-firebase-testing',
15+
storage: {
16+
rules: `rules_version = '2';
1417
service firebase.storage {
1518
match /b/{bucket}/o {
1619
match /{document=**} {
@@ -27,6 +30,9 @@ exports.seed = async function seed(path) {
2730
}
2831
}
2932
}`,
33+
host: 'localhost',
34+
port: 9199,
35+
},
3036
});
3137

3238
return Promise.all([

tests/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@
2929
"react-native": "0.65.1"
3030
},
3131
"devDependencies": {
32-
"@firebase/rules-unit-testing": "^1.3.14",
32+
"@firebase/rules-unit-testing": "^2.0.0",
3333
"@react-native-firebase/private-tests-helpers": "0.0.13",
3434
"a2a": "^0.2.0",
3535
"babel-plugin-istanbul": "^6.0.0",
3636
"detox": "17.14.6",
37+
"firebase": "^9.0.0",
3738
"firebase-tools": "^9.17.0",
3839
"jest-circus": "^27.1.0",
3940
"jest-environment-node": "^27.1.0",

0 commit comments

Comments
 (0)