@@ -35,9 +35,7 @@ async function expectError(
3535 await promise ;
3636 } catch ( e ) {
3737 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 ) ;
4139 expect ( e . message ) . to . equal ( message ) ;
4240 expect ( e . details ) . to . deep . equal ( details ) ;
4341 }
@@ -106,25 +104,29 @@ describe('Firebase Functions > Call', () => {
106104 it ( 'missing result' , async ( ) => {
107105 const functions = createTestService ( app , region ) ;
108106 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+ ) ;
110112 } ) ;
111113
112114 it ( 'unhandled error' , async ( ) => {
113115 const functions = createTestService ( app , region ) ;
114116 const func = functions . httpsCallable ( 'unhandledErrorTest' ) ;
115- await expectError ( func ( ) , 'internal' , 'internal' ) ;
117+ await expectError ( func ( ) , 'functions/ internal' , 'internal' ) ;
116118 } ) ;
117119
118120 it ( 'unknown error' , async ( ) => {
119121 const functions = createTestService ( app , region ) ;
120122 const func = functions . httpsCallable ( 'unknownErrorTest' ) ;
121- await expectError ( func ( ) , 'internal' , 'internal' ) ;
123+ await expectError ( func ( ) , 'functions/ internal' , 'internal' ) ;
122124 } ) ;
123125
124126 it ( 'explicit error' , async ( ) => {
125127 const functions = createTestService ( app , region ) ;
126128 const func = functions . httpsCallable ( 'explicitErrorTest' ) ;
127- await expectError ( func ( ) , 'out-of-range' , 'explicit nope' , {
129+ await expectError ( func ( ) , 'functions/ out-of-range' , 'explicit nope' , {
128130 start : 10 ,
129131 end : 20 ,
130132 long : 30
@@ -134,12 +136,16 @@ describe('Firebase Functions > Call', () => {
134136 it ( 'http error' , async ( ) => {
135137 const functions = createTestService ( app , region ) ;
136138 const func = functions . httpsCallable ( 'httpErrorTest' ) ;
137- await expectError ( func ( ) , 'invalid-argument' , 'invalid-argument' ) ;
139+ await expectError ( func ( ) , 'functions/ invalid-argument' , 'invalid-argument' ) ;
138140 } ) ;
139141
140142 it ( 'timeout' , async ( ) => {
141143 const functions = createTestService ( app , region ) ;
142144 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+ ) ;
144150 } ) ;
145151} ) ;
0 commit comments