File tree 2 files changed +27
-1
lines changed
packages/rules-unit-testing 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -583,7 +583,8 @@ export function assertFails(pr: Promise<any>): any {
583
583
const isPermissionDenied =
584
584
errCode === 'permission-denied' ||
585
585
errCode === 'permission_denied' ||
586
- errMessage . indexOf ( 'permission_denied' ) >= 0 ;
586
+ errMessage . indexOf ( 'permission_denied' ) >= 0 ||
587
+ errMessage . indexOf ( 'permission denied' ) >= 0 ;
587
588
588
589
if ( ! isPermissionDenied ) {
589
590
return Promise . reject (
Original file line number Diff line number Diff line change @@ -128,6 +128,31 @@ describe('Testing Module Tests', function () {
128
128
. catch ( ( ) => { } ) ;
129
129
} ) ;
130
130
131
+ it ( 'assertFails() if message is Permission denied' , async function ( ) {
132
+ const success = Promise . resolve ( 'success' ) ;
133
+ const permissionDenied = Promise . reject ( {
134
+ message : 'Permission denied'
135
+ } ) ;
136
+ const otherFailure = Promise . reject ( 'failure' ) ;
137
+ await firebase
138
+ . assertFails ( success )
139
+ . then ( ( ) => {
140
+ throw new Error ( 'Expected success to fail.' ) ;
141
+ } )
142
+ . catch ( ( ) => { } ) ;
143
+
144
+ await firebase . assertFails ( permissionDenied ) . catch ( ( ) => {
145
+ throw new Error ( 'Expected permissionDenied to succeed.' ) ;
146
+ } ) ;
147
+
148
+ await firebase
149
+ . assertFails ( otherFailure )
150
+ . then ( ( ) => {
151
+ throw new Error ( 'Expected otherFailure to fail.' ) ;
152
+ } )
153
+ . catch ( ( ) => { } ) ;
154
+ } ) ;
155
+
131
156
it ( 'discoverEmulators() finds all running emulators' , async ( ) => {
132
157
const options = await firebase . discoverEmulators ( ) ;
133
158
You can’t perform that action at this time.
0 commit comments