Skip to content

Commit 49461e1

Browse files
committed
assert chatSessionStream throws the request error
1 parent bf1b031 commit 49461e1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/ai/src/methods/chat-session.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { ChatSession } from './chat-session';
2525
import { ApiSettings } from '../types/internal';
2626
import { VertexAIBackend } from '../backend';
2727
import { fakeChromeAdapter } from '../../test-utils/get-fake-firebase-services';
28+
import { AIError } from '../errors';
2829

2930
use(sinonChai);
3031
use(chaiAsPromised);
@@ -231,7 +232,9 @@ describe('ChatSession', () => {
231232
try {
232233
// This will throw since generateContentStream will reject immediately.
233234
await chatSession.sendMessageStream('hello');
234-
} catch (_) {}
235+
} catch (e) {
236+
expect((e as unknown as any).name).to.equal('foo');
237+
}
235238

236239
expect(consoleStub).to.not.have.been.called;
237240
});

0 commit comments

Comments
 (0)