@@ -27,8 +27,8 @@ before(() => {
27
27
chai . use ( chaiAsPromised ) ;
28
28
} ) ;
29
29
30
- describe ( 'Testing Module Tests' , function ( ) {
31
- it ( 'assertSucceeds() iff success' , async function ( ) {
30
+ describe ( 'Testing Module Tests' , function ( ) {
31
+ it ( 'assertSucceeds() iff success' , async function ( ) {
32
32
const success = Promise . resolve ( 'success' ) ;
33
33
const failure = Promise . reject ( 'failure' ) ;
34
34
await firebase . assertSucceeds ( success ) . catch ( ( ) => {
@@ -39,43 +39,45 @@ describe('Testing Module Tests', function () {
39
39
. then ( ( ) => {
40
40
throw new Error ( 'Expected failure to fail.' ) ;
41
41
} )
42
- . catch ( ( ) => { } ) ;
42
+ . catch ( ( ) => { } ) ;
43
43
} ) ;
44
44
45
- it ( 'assertFails() iff failure' , async function ( ) {
45
+ it ( 'assertFails() iff failure' , async function ( ) {
46
46
const success = Promise . resolve ( 'success' ) ;
47
47
const failure = Promise . reject ( 'failure' ) ;
48
48
await firebase
49
49
. assertFails ( success )
50
50
. then ( ( ) => {
51
51
throw new Error ( 'Expected success to fail.' ) ;
52
52
} )
53
- . catch ( ( ) => { } ) ;
53
+ . catch ( ( ) => { } ) ;
54
54
await firebase . assertFails ( failure ) . catch ( ( ) => {
55
55
throw new Error ( 'Expected failure to succeed.' ) ;
56
56
} ) ;
57
57
} ) ;
58
58
59
- it ( 'initializeTestApp() with auth=null does not set access token' , async function ( ) {
59
+ it ( 'initializeTestApp() with auth=null does not set access token' , async function ( ) {
60
60
const app = firebase . initializeTestApp ( {
61
61
projectId : 'foo' ,
62
62
auth : undefined
63
63
} ) ;
64
64
65
- const authInternal = ( app as unknown as _FirebaseApp )
66
- . container . getProvider ( 'auth-internal' ) . getImmediate ( { optional : true } ) ;
67
- // Auth instance will not be available because no API Key is provided
65
+ const authInternal = ( ( app as unknown ) as _FirebaseApp ) . container
66
+ . getProvider ( 'auth-internal' )
67
+ . getImmediate ( { optional : true } ) ;
68
+ // Auth instance will not be available because no API Key is provided
68
69
expect ( authInternal ) . to . be . null ;
69
70
} ) ;
70
71
71
- it ( 'initializeTestApp() with auth sets the correct access token' , async function ( ) {
72
+ it ( 'initializeTestApp() with auth sets the correct access token' , async function ( ) {
72
73
const auth = { uid : 'alice' } ;
73
74
const app = firebase . initializeTestApp ( {
74
75
projectId : 'foo' ,
75
76
auth : auth
76
77
} ) ;
77
- const authInternal = ( app as unknown as _FirebaseApp )
78
- . container . getProvider ( 'auth-internal' ) . getImmediate ( ) ;
78
+ const authInternal = ( ( app as unknown ) as _FirebaseApp ) . container
79
+ . getProvider ( 'auth-internal' )
80
+ . getImmediate ( ) ;
79
81
80
82
const token = await authInternal . getToken ( ) ;
81
83
expect ( token ) . to . have . keys ( 'accessToken' ) ;
@@ -86,17 +88,18 @@ describe('Testing Module Tests', function () {
86
88
expect ( claims ) . to . deep . equal ( { uid : auth . uid , iat : 0 , sub : auth . uid } ) ;
87
89
} ) ;
88
90
89
- it ( 'initializeAdminApp() sets the access token to "owner"' , async function ( ) {
91
+ it ( 'initializeAdminApp() sets the access token to "owner"' , async function ( ) {
90
92
const app = firebase . initializeAdminApp ( { projectId : 'foo' } ) ;
91
- const authInternal = ( app as unknown as _FirebaseApp )
92
- . container . getProvider ( 'auth-internal' ) . getImmediate ( ) ;
93
+ const authInternal = ( ( app as unknown ) as _FirebaseApp ) . container
94
+ . getProvider ( 'auth-internal' )
95
+ . getImmediate ( ) ;
93
96
94
97
const token = await authInternal . getToken ( ) ;
95
98
expect ( token ) . to . have . keys ( 'accessToken' ) ;
96
99
expect ( token ! . accessToken ) . to . be . string ( 'owner' ) ;
97
100
} ) ;
98
101
99
- it ( 'loadDatabaseRules() throws if no databaseName or rules' , async function ( ) {
102
+ it ( 'loadDatabaseRules() throws if no databaseName or rules' , async function ( ) {
100
103
// eslint-disable-next-line @typescript-eslint/no-explicit-any
101
104
await expect ( ( firebase as any ) . loadDatabaseRules . bind ( null , { } ) ) . to . throw (
102
105
/ d a t a b a s e N a m e n o t s p e c i f i e d /
@@ -111,13 +114,13 @@ describe('Testing Module Tests', function () {
111
114
) . to . throw ( / d a t a b a s e N a m e n o t s p e c i f i e d / ) ;
112
115
} ) ;
113
116
114
- it ( 'loadDatabaseRules() tries to make a network request' , async function ( ) {
117
+ it ( 'loadDatabaseRules() tries to make a network request' , async function ( ) {
115
118
await expect (
116
119
firebase . loadDatabaseRules ( { databaseName : 'foo' , rules : '{}' } )
117
120
) . to . be . rejectedWith ( / E C O N N R E F U S E D / ) ;
118
121
} ) ;
119
122
120
- it ( 'loadFirestoreRules() succeeds on valid input' , async function ( ) {
123
+ it ( 'loadFirestoreRules() succeeds on valid input' , async function ( ) {
121
124
let promise = firebase . loadFirestoreRules ( {
122
125
projectId : 'foo' ,
123
126
rules : `service cloud.firestore {
@@ -129,28 +132,28 @@ describe('Testing Module Tests', function () {
129
132
await expect ( promise ) . to . be . rejectedWith ( / U N A V A I L A B L E / ) ;
130
133
} ) ;
131
134
132
- it ( 'clearFirestoreData() succeeds on valid input' , async function ( ) {
135
+ it ( 'clearFirestoreData() succeeds on valid input' , async function ( ) {
133
136
let promise = firebase . clearFirestoreData ( {
134
137
projectId : 'foo'
135
138
} ) ;
136
139
await expect ( promise ) . to . be . rejectedWith ( / U N A V A I L A B L E / ) ;
137
140
} ) ;
138
141
139
- it ( 'apps() returns apps created with initializeTestApp' , async function ( ) {
142
+ it ( 'apps() returns apps created with initializeTestApp' , async function ( ) {
140
143
const numApps = firebase . apps ( ) . length ;
141
144
await firebase . initializeTestApp ( { databaseName : 'foo' , auth : undefined } ) ;
142
145
expect ( firebase . apps ( ) . length ) . to . equal ( numApps + 1 ) ;
143
146
await firebase . initializeTestApp ( { databaseName : 'bar' , auth : undefined } ) ;
144
147
expect ( firebase . apps ( ) . length ) . to . equal ( numApps + 2 ) ;
145
148
} ) ;
146
149
147
- it ( 'there is a way to get database timestamps' , function ( ) {
150
+ it ( 'there is a way to get database timestamps' , function ( ) {
148
151
expect ( firebase . database . ServerValue . TIMESTAMP ) . to . deep . equal ( {
149
152
'.sv' : 'timestamp'
150
153
} ) ;
151
154
} ) ;
152
155
153
- it ( 'there is a way to get firestore timestamps' , function ( ) {
156
+ it ( 'there is a way to get firestore timestamps' , function ( ) {
154
157
expect ( firebase . firestore . FieldValue . serverTimestamp ( ) ) . not . to . be . null ;
155
158
} ) ;
156
159
} ) ;
0 commit comments