18
18
describe ( 'config' , function ( ) {
19
19
describe ( 'meta' , function ( ) {
20
20
it ( 'should read Info.plist/AndroidManifest.xml meta data' , async function ( ) {
21
- const metaData = await NativeModules . RNFBAppModule . metaGetAll ( ) ;
21
+ const { metaGetAll } = modular ;
22
+ const metaData = await metaGetAll ( ) ;
22
23
if ( Platform . other ) return ;
23
24
metaData . rnfirebase_meta_testing_string . should . equal ( 'abc' ) ;
24
25
metaData . rnfirebase_meta_testing_boolean_false . should . equal ( false ) ;
@@ -28,7 +29,8 @@ describe('config', function () {
28
29
29
30
describe ( 'json' , function ( ) {
30
31
it ( 'should read firebase.json data' , async function ( ) {
31
- const jsonData = await NativeModules . RNFBAppModule . jsonGetAll ( ) ;
32
+ const { jsonGetAll } = modular ;
33
+ const jsonData = await jsonGetAll ( ) ;
32
34
if ( Platform . other ) return ;
33
35
jsonData . rnfirebase_json_testing_string . should . equal ( 'abc' ) ;
34
36
jsonData . rnfirebase_json_testing_boolean_false . should . equal ( false ) ;
@@ -38,40 +40,43 @@ describe('config', function () {
38
40
39
41
describe ( 'prefs' , function ( ) {
40
42
beforeEach ( async function ( ) {
41
- await NativeModules . RNFBAppModule . preferencesClearAll ( ) ;
43
+ const { preferencesClearAll } = modular ;
44
+ await preferencesClearAll ( ) ;
42
45
} ) ;
43
46
44
47
// NOTE: "preferencesClearAll" clears Firestore settings. Set DB as emulator again.
45
48
after ( async function ( ) {
49
+ const { connectFirestoreEmulator, getFirestore } = firestoreModular ;
46
50
if ( Platform . other ) return ;
47
- await firebase
48
- . firestore ( )
49
- . settings ( { host : 'localhost:8080' , ssl : false , persistence : true } ) ;
51
+ connectFirestoreEmulator ( getFirestore ( ) , 'localhost' , 8080 ) ;
50
52
} ) ;
51
53
52
54
it ( 'should set bool values' , async function ( ) {
53
- const prefsBefore = await NativeModules . RNFBAppModule . preferencesGetAll ( ) ;
55
+ const { preferencesGetAll, preferencesSetBool } = modular ;
56
+ const prefsBefore = await preferencesGetAll ( ) ;
54
57
should . equal ( prefsBefore . invertase_oss , undefined ) ;
55
- await NativeModules . RNFBAppModule . preferencesSetBool ( 'invertase_oss' , true ) ;
56
- const prefsAfter = await NativeModules . RNFBAppModule . preferencesGetAll ( ) ;
58
+ await preferencesSetBool ( 'invertase_oss' , true ) ;
59
+ const prefsAfter = await preferencesGetAll ( ) ;
57
60
prefsAfter . invertase_oss . should . equal ( true ) ;
58
61
} ) ;
59
62
60
63
it ( 'should set string values' , async function ( ) {
61
- const prefsBefore = await NativeModules . RNFBAppModule . preferencesGetAll ( ) ;
64
+ const { preferencesGetAll, preferencesSetString } = modular ;
65
+ const prefsBefore = await preferencesGetAll ( ) ;
62
66
should . equal ( prefsBefore . invertase_oss , undefined ) ;
63
- await NativeModules . RNFBAppModule . preferencesSetString ( 'invertase_oss' , 'invertase.io' ) ;
64
- const prefsAfter = await NativeModules . RNFBAppModule . preferencesGetAll ( ) ;
67
+ await preferencesSetString ( 'invertase_oss' , 'invertase.io' ) ;
68
+ const prefsAfter = await preferencesGetAll ( ) ;
65
69
prefsAfter . invertase_oss . should . equal ( 'invertase.io' ) ;
66
70
} ) ;
67
71
68
72
it ( 'should clear all values' , async function ( ) {
69
- await NativeModules . RNFBAppModule . preferencesSetString ( 'invertase_oss' , 'invertase.io' ) ;
70
- const prefsBefore = await NativeModules . RNFBAppModule . preferencesGetAll ( ) ;
73
+ const { preferencesClearAll, preferencesGetAll, preferencesSetString } = modular ;
74
+ await preferencesSetString ( 'invertase_oss' , 'invertase.io' ) ;
75
+ const prefsBefore = await preferencesGetAll ( ) ;
71
76
prefsBefore . invertase_oss . should . equal ( 'invertase.io' ) ;
72
77
73
- await NativeModules . RNFBAppModule . preferencesClearAll ( ) ;
74
- const prefsAfter = await NativeModules . RNFBAppModule . preferencesGetAll ( ) ;
78
+ await preferencesClearAll ( ) ;
79
+ const prefsAfter = await preferencesGetAll ( ) ;
75
80
should . equal ( prefsAfter . invertase_oss , undefined ) ;
76
81
} ) ;
77
82
} ) ;
0 commit comments