@@ -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,25 @@ 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 ( func ( ) , 'functions/ internal' , 'Response is missing data field.' ) ;
110
108
} ) ;
111
109
112
110
it ( 'unhandled error' , async ( ) => {
113
111
const functions = createTestService ( app , region ) ;
114
112
const func = functions . httpsCallable ( 'unhandledErrorTest' ) ;
115
- await expectError ( func ( ) , 'internal' , 'internal' ) ;
113
+ await expectError ( func ( ) , 'functions/ internal' , 'internal' ) ;
116
114
} ) ;
117
115
118
116
it ( 'unknown error' , async ( ) => {
119
117
const functions = createTestService ( app , region ) ;
120
118
const func = functions . httpsCallable ( 'unknownErrorTest' ) ;
121
- await expectError ( func ( ) , 'internal' , 'internal' ) ;
119
+ await expectError ( func ( ) , 'functions/ internal' , 'internal' ) ;
122
120
} ) ;
123
121
124
122
it ( 'explicit error' , async ( ) => {
125
123
const functions = createTestService ( app , region ) ;
126
124
const func = functions . httpsCallable ( 'explicitErrorTest' ) ;
127
- await expectError ( func ( ) , 'out-of-range' , 'explicit nope' , {
125
+ await expectError ( func ( ) , 'functions/ out-of-range' , 'explicit nope' , {
128
126
start : 10 ,
129
127
end : 20 ,
130
128
long : 30
@@ -134,12 +132,12 @@ describe('Firebase Functions > Call', () => {
134
132
it ( 'http error' , async ( ) => {
135
133
const functions = createTestService ( app , region ) ;
136
134
const func = functions . httpsCallable ( 'httpErrorTest' ) ;
137
- await expectError ( func ( ) , 'invalid-argument' , 'invalid-argument' ) ;
135
+ await expectError ( func ( ) , 'functions/ invalid-argument' , 'invalid-argument' ) ;
138
136
} ) ;
139
137
140
138
it ( 'timeout' , async ( ) => {
141
139
const functions = createTestService ( app , region ) ;
142
140
const func = functions . httpsCallable ( 'timeoutTest' , { timeout : 10 } ) ;
143
- await expectError ( func ( ) , 'deadline-exceeded' , 'deadline-exceeded' ) ;
141
+ await expectError ( func ( ) , 'functions/ deadline-exceeded' , 'deadline-exceeded' ) ;
144
142
} ) ;
145
143
} ) ;
0 commit comments