File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
packages/rules-unit-testing/test Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,31 @@ describe('Testing Module Tests', function () {
103
103
. catch ( ( ) => { } ) ;
104
104
} ) ;
105
105
106
+ it ( 'assertFails() if code is PERMISSION_DENIED' , async function ( ) {
107
+ const success = Promise . resolve ( 'success' ) ;
108
+ const permissionDenied = Promise . reject ( {
109
+ code : 'PERMISSION_DENIED'
110
+ } ) ;
111
+ const otherFailure = Promise . reject ( 'failure' ) ;
112
+ await firebase
113
+ . assertFails ( success )
114
+ . then ( ( ) => {
115
+ throw new Error ( 'Expected success to fail.' ) ;
116
+ } )
117
+ . catch ( ( ) => { } ) ;
118
+
119
+ await firebase . assertFails ( permissionDenied ) . catch ( ( ) => {
120
+ throw new Error ( 'Expected permissionDenied to succeed.' ) ;
121
+ } ) ;
122
+
123
+ await firebase
124
+ . assertFails ( otherFailure )
125
+ . then ( ( ) => {
126
+ throw new Error ( 'Expected otherFailure to fail.' ) ;
127
+ } )
128
+ . catch ( ( ) => { } ) ;
129
+ } ) ;
130
+
106
131
it ( 'initializeTestApp() with auth=null does not set access token' , async function ( ) {
107
132
const app = firebase . initializeTestApp ( {
108
133
projectId : 'foo' ,
You can’t perform that action at this time.
0 commit comments