Skip to content

Commit c08f984

Browse files
committed
fix: Make unit test less brittle and add CI
1 parent 0470aa8 commit c08f984

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: ai-providers/server-ai-langchain
2+
3+
on:
4+
push:
5+
branches: [main, 'feat/**']
6+
paths-ignore:
7+
- '**.md' #Do not need to run CI for markdown changes.
8+
pull_request:
9+
branches: [main, 'feat/**']
10+
paths-ignore:
11+
- '**.md'
12+
13+
jobs:
14+
build-test-langchain-provider:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: 22.x
21+
registry-url: 'https://registry.npmjs.org'
22+
- id: shared
23+
name: Shared CI Steps
24+
uses: ./actions/ci
25+
with:
26+
workspace_name: '@launchdarkly/server-sdk-ai-langchain'
27+
workspace_path: packages/ai-providers/server-ai-langchain

packages/ai-providers/server-ai-langchain/__tests__/LangChainProvider.test.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,7 @@ describe('LangChainProvider', () => {
141141

142142
expect(result.metrics.success).toBe(false);
143143
expect(result.message.content).toBe('');
144-
expect(mockLogger.warn).toHaveBeenCalledWith(
145-
'Multimodal response not supported, expecting a string. Content type: object, Content:',
146-
JSON.stringify({ type: 'image', data: 'base64data' }, null, 2),
147-
);
144+
expect(mockLogger.warn).toHaveBeenCalledTimes(1);
148145
});
149146

150147
it('returns success=false for array content and logs warning', async () => {
@@ -156,10 +153,7 @@ describe('LangChainProvider', () => {
156153

157154
expect(result.metrics.success).toBe(false);
158155
expect(result.message.content).toBe('');
159-
expect(mockLogger.warn).toHaveBeenCalledWith(
160-
'Multimodal response not supported, expecting a string. Content type: object, Content:',
161-
JSON.stringify(['text', { type: 'image', data: 'base64data' }], null, 2),
162-
);
156+
expect(mockLogger.warn).toHaveBeenCalledTimes(1);
163157
});
164158
});
165159

0 commit comments

Comments
 (0)