Skip to content

Commit bad6ec5

Browse files
committed
Update functions-compat tests
1 parent 87f84c2 commit bad6ec5

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

packages/functions-compat/src/callable.test.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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,25 @@ 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(func(), 'functions/internal', 'Response is missing data field.');
110108
});
111109

112110
it('unhandled error', async () => {
113111
const functions = createTestService(app, region);
114112
const func = functions.httpsCallable('unhandledErrorTest');
115-
await expectError(func(), 'internal', 'internal');
113+
await expectError(func(), 'functions/internal', 'internal');
116114
});
117115

118116
it('unknown error', async () => {
119117
const functions = createTestService(app, region);
120118
const func = functions.httpsCallable('unknownErrorTest');
121-
await expectError(func(), 'internal', 'internal');
119+
await expectError(func(), 'functions/internal', 'internal');
122120
});
123121

124122
it('explicit error', async () => {
125123
const functions = createTestService(app, region);
126124
const func = functions.httpsCallable('explicitErrorTest');
127-
await expectError(func(), 'out-of-range', 'explicit nope', {
125+
await expectError(func(), 'functions/out-of-range', 'explicit nope', {
128126
start: 10,
129127
end: 20,
130128
long: 30
@@ -134,12 +132,12 @@ describe('Firebase Functions > Call', () => {
134132
it('http error', async () => {
135133
const functions = createTestService(app, region);
136134
const func = functions.httpsCallable('httpErrorTest');
137-
await expectError(func(), 'invalid-argument', 'invalid-argument');
135+
await expectError(func(), 'functions/invalid-argument', 'invalid-argument');
138136
});
139137

140138
it('timeout', async () => {
141139
const functions = createTestService(app, region);
142140
const func = functions.httpsCallable('timeoutTest', { timeout: 10 });
143-
await expectError(func(), 'deadline-exceeded', 'deadline-exceeded');
141+
await expectError(func(), 'functions/deadline-exceeded', 'deadline-exceeded');
144142
});
145143
});

0 commit comments

Comments
 (0)