Skip to content

Commit a2236a9

Browse files
authored
fix: Make unit test less brittle and add CI (#953)
1 parent 0470aa8 commit a2236a9

File tree

5 files changed

+44
-8
lines changed

5 files changed

+44
-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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
18+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"include": ["src/**/*"],
4+
"compilerOptions": {
5+
"composite": true
6+
}
7+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": ["../../../typedoc.base.json"],
3+
"entryPoints": ["src/index.ts"],
4+
"out": "docs"
5+
}

tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,8 @@
7979
{
8080
"path": "./packages/sdk/combined-browser/tsconfig.ref.json"
8181
},
82+
{
83+
"path": "./packages/ai-providers/server-ai-langchain/tsconfig.ref.json"
84+
}
8285
]
8386
}

0 commit comments

Comments
 (0)