@@ -35,9 +35,7 @@ async function expectError(
35
35
await promise ;
36
36
} catch ( e ) {
37
37
failed = true ;
38
- // Errors coming from callable functions usually have the functions
39
- // code in the message since it's thrown inside functions.
40
- expect ( e . code ) . to . match ( new RegExp ( `functions.*/${ code } ` ) ) ;
38
+ expect ( e . code ) . to . equal ( code ) ;
41
39
expect ( e . message ) . to . equal ( message ) ;
42
40
expect ( e . details ) . to . deep . equal ( details ) ;
43
41
}
@@ -106,25 +104,29 @@ describe('Firebase Functions > Call', () => {
106
104
it ( 'missing result' , async ( ) => {
107
105
const functions = createTestService ( app , region ) ;
108
106
const func = functions . httpsCallable ( 'missingResultTest' ) ;
109
- await expectError ( func ( ) , 'internal' , 'Response is missing data field.' ) ;
107
+ await expectError (
108
+ func ( ) ,
109
+ 'functions/internal' ,
110
+ 'Response is missing data field.'
111
+ ) ;
110
112
} ) ;
111
113
112
114
it ( 'unhandled error' , async ( ) => {
113
115
const functions = createTestService ( app , region ) ;
114
116
const func = functions . httpsCallable ( 'unhandledErrorTest' ) ;
115
- await expectError ( func ( ) , 'internal' , 'internal' ) ;
117
+ await expectError ( func ( ) , 'functions/ internal' , 'internal' ) ;
116
118
} ) ;
117
119
118
120
it ( 'unknown error' , async ( ) => {
119
121
const functions = createTestService ( app , region ) ;
120
122
const func = functions . httpsCallable ( 'unknownErrorTest' ) ;
121
- await expectError ( func ( ) , 'internal' , 'internal' ) ;
123
+ await expectError ( func ( ) , 'functions/ internal' , 'internal' ) ;
122
124
} ) ;
123
125
124
126
it ( 'explicit error' , async ( ) => {
125
127
const functions = createTestService ( app , region ) ;
126
128
const func = functions . httpsCallable ( 'explicitErrorTest' ) ;
127
- await expectError ( func ( ) , 'out-of-range' , 'explicit nope' , {
129
+ await expectError ( func ( ) , 'functions/ out-of-range' , 'explicit nope' , {
128
130
start : 10 ,
129
131
end : 20 ,
130
132
long : 30
@@ -134,12 +136,16 @@ describe('Firebase Functions > Call', () => {
134
136
it ( 'http error' , async ( ) => {
135
137
const functions = createTestService ( app , region ) ;
136
138
const func = functions . httpsCallable ( 'httpErrorTest' ) ;
137
- await expectError ( func ( ) , 'invalid-argument' , 'invalid-argument' ) ;
139
+ await expectError ( func ( ) , 'functions/ invalid-argument' , 'invalid-argument' ) ;
138
140
} ) ;
139
141
140
142
it ( 'timeout' , async ( ) => {
141
143
const functions = createTestService ( app , region ) ;
142
144
const func = functions . httpsCallable ( 'timeoutTest' , { timeout : 10 } ) ;
143
- await expectError ( func ( ) , 'deadline-exceeded' , 'deadline-exceeded' ) ;
145
+ await expectError (
146
+ func ( ) ,
147
+ 'functions/deadline-exceeded' ,
148
+ 'deadline-exceeded'
149
+ ) ;
144
150
} ) ;
145
151
} ) ;
0 commit comments