Skip to content

Commit db30cd1

Browse files
authored
Merge pull request #1077 from objectstack-ai/copilot/fix-ci-build-test-errors-another-one
fix: resolve CI test failures across 6 packages
2 parents 563c087 + b98cac2 commit db30cd1

File tree

8 files changed

+50
-3
lines changed

8 files changed

+50
-3
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
- **CI Test Failures** — Resolved test failures across multiple packages:
12+
- `@objectstack/service-ai`: Fixed SDK fallback test by mocking `@ai-sdk/openai` dynamic import
13+
(SDK now available as transitive workspace dependency)
14+
- `@objectstack/nuxt`, `@objectstack/nextjs`, `@objectstack/fastify`, `@objectstack/sveltekit`:
15+
Added missing `prefix` argument to `dispatch()` assertion calls in adapter tests
16+
- `@objectstack/plugin-auth`: Updated `dependencies` assertion and added `manifest` service mock
17+
to match current plugin implementation
18+
1019
### Added
1120
- **AIServicePlugin Auto-Detection** — AIServicePlugin now automatically detects and initializes
1221
LLM providers based on environment variables, eliminating the need for manual adapter configuration

packages/adapters/fastify/src/fastify.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ describe('objectStackPlugin', () => {
9696
undefined,
9797
expect.any(Object),
9898
expect.objectContaining({ request: expect.anything() }),
99+
'/api',
99100
);
100101
});
101102

@@ -112,6 +113,7 @@ describe('objectStackPlugin', () => {
112113
undefined,
113114
expect.any(Object),
114115
expect.objectContaining({ request: expect.anything() }),
116+
'/api',
115117
);
116118
});
117119

packages/adapters/nextjs/src/metadata-api.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ describe('Next.js Metadata API Integration Tests', () => {
132132
undefined,
133133
{},
134134
expect.objectContaining({ request: expect.anything() }),
135+
'/api',
135136
);
136137
});
137138
});
@@ -159,6 +160,7 @@ describe('Next.js Metadata API Integration Tests', () => {
159160
undefined,
160161
{},
161162
expect.objectContaining({ request: expect.anything() }),
163+
'/api',
162164
);
163165
});
164166
});
@@ -185,6 +187,7 @@ describe('Next.js Metadata API Integration Tests', () => {
185187
body,
186188
{},
187189
expect.objectContaining({ request: expect.anything() }),
190+
'/api',
188191
);
189192
});
190193
});
@@ -207,6 +210,7 @@ describe('Next.js Metadata API Integration Tests', () => {
207210
body,
208211
{},
209212
expect.objectContaining({ request: expect.anything() }),
213+
'/api',
210214
);
211215
});
212216
});
@@ -238,6 +242,7 @@ describe('Next.js Metadata API Integration Tests', () => {
238242
undefined,
239243
{},
240244
expect.objectContaining({ request: expect.anything() }),
245+
'/api',
241246
);
242247
});
243248

@@ -250,6 +255,7 @@ describe('Next.js Metadata API Integration Tests', () => {
250255
undefined,
251256
{},
252257
expect.objectContaining({ request: expect.anything() }),
258+
'/api',
253259
);
254260
});
255261

@@ -262,6 +268,7 @@ describe('Next.js Metadata API Integration Tests', () => {
262268
undefined,
263269
{},
264270
expect.objectContaining({ request: expect.anything() }),
271+
'/api',
265272
);
266273
});
267274
});
@@ -696,6 +703,7 @@ describe('Next.js Metadata API Integration Tests', () => {
696703
undefined,
697704
{},
698705
expect.objectContaining({ request: expect.anything() }),
706+
'/api',
699707
);
700708
});
701709

@@ -709,6 +717,7 @@ describe('Next.js Metadata API Integration Tests', () => {
709717
undefined,
710718
{},
711719
expect.objectContaining({ request: expect.anything() }),
720+
'/api',
712721
);
713722
});
714723
});

packages/adapters/nextjs/src/nextjs.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ describe('createRouteHandler', () => {
284284
undefined,
285285
expect.any(Object),
286286
expect.objectContaining({ request: expect.anything() }),
287+
'/api',
287288
);
288289
});
289290

@@ -299,6 +300,7 @@ describe('createRouteHandler', () => {
299300
body,
300301
expect.any(Object),
301302
expect.objectContaining({ request: expect.anything() }),
303+
'/api',
302304
);
303305
});
304306

@@ -314,6 +316,7 @@ describe('createRouteHandler', () => {
314316
body,
315317
expect.any(Object),
316318
expect.objectContaining({ request: expect.anything() }),
319+
'/api',
317320
);
318321
});
319322
});
@@ -330,6 +333,7 @@ describe('createRouteHandler', () => {
330333
undefined,
331334
expect.any(Object),
332335
expect.objectContaining({ request: expect.anything() }),
336+
'/api',
333337
);
334338
});
335339

@@ -345,6 +349,7 @@ describe('createRouteHandler', () => {
345349
body,
346350
expect.any(Object),
347351
expect.objectContaining({ request: expect.anything() }),
352+
'/api',
348353
);
349354
});
350355

@@ -360,6 +365,7 @@ describe('createRouteHandler', () => {
360365
body,
361366
expect.any(Object),
362367
expect.objectContaining({ request: expect.anything() }),
368+
'/api',
363369
);
364370
});
365371

packages/adapters/nuxt/src/nuxt.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ describe('createH3Router', () => {
106106
undefined,
107107
expect.any(Object),
108108
expect.objectContaining({ request: expect.anything() }),
109+
'/api',
109110
);
110111
});
111112

@@ -119,6 +120,7 @@ describe('createH3Router', () => {
119120
undefined,
120121
expect.any(Object),
121122
expect.objectContaining({ request: expect.anything() }),
123+
'/api',
122124
);
123125
});
124126

packages/adapters/sveltekit/src/sveltekit.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ describe('createRequestHandler', () => {
176176
undefined,
177177
expect.any(Object),
178178
expect.objectContaining({ request: expect.anything() }),
179+
'/api',
179180
);
180181
});
181182
});
@@ -191,6 +192,7 @@ describe('createRequestHandler', () => {
191192
undefined,
192193
expect.any(Object),
193194
expect.objectContaining({ request: expect.anything() }),
195+
'/api',
194196
);
195197
});
196198

@@ -205,6 +207,7 @@ describe('createRequestHandler', () => {
205207
body,
206208
expect.any(Object),
207209
expect.objectContaining({ request: expect.anything() }),
210+
'/api',
208211
);
209212
});
210213

packages/plugins/plugin-auth/src/auth-plugin.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ describe('AuthPlugin', () => {
2424
beforeEach(() => {
2525
mockContext = {
2626
registerService: vi.fn(),
27-
getService: vi.fn(),
27+
getService: vi.fn((name: string) => {
28+
if (name === 'manifest') return { register: vi.fn() };
29+
if (name === 'data') return undefined;
30+
return undefined;
31+
}),
2832
getServices: vi.fn(() => new Map()),
2933
hook: vi.fn(),
3034
trigger: vi.fn(),
@@ -47,7 +51,7 @@ describe('AuthPlugin', () => {
4751
expect(authPlugin.name).toBe('com.objectstack.auth');
4852
expect(authPlugin.type).toBe('standard');
4953
expect(authPlugin.version).toBe('1.0.0');
50-
expect(authPlugin.dependencies).toEqual([]);
54+
expect(authPlugin.dependencies).toEqual(['com.objectstack.engine.objectql']);
5155
});
5256
});
5357

packages/services/service-ai/src/__tests__/ai-service.test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,16 @@ describe('AIServicePlugin', () => {
868868
});
869869

870870
it('should fallback to MemoryLLMAdapter when provider SDK is not installed', async () => {
871-
const plugin = new AIServicePlugin();
871+
// Mock all provider SDKs to simulate them not being installed.
872+
// In the workspace @ai-sdk/openai may be resolvable as a transitive
873+
// dependency, so we must explicitly make the dynamic import fail.
874+
vi.doMock('@ai-sdk/openai', () => { throw new Error('Cannot find module \'@ai-sdk/openai\''); });
875+
vi.doMock('@ai-sdk/anthropic', () => { throw new Error('Cannot find module \'@ai-sdk/anthropic\''); });
876+
vi.doMock('@ai-sdk/google', () => { throw new Error('Cannot find module \'@ai-sdk/google\''); });
877+
878+
// Re-import the plugin module so it picks up the mocked imports
879+
const { AIServicePlugin: FreshPlugin } = await import('../plugin.js');
880+
const plugin = new FreshPlugin();
872881
const ctx = createMockContext();
873882

874883
const oldEnv = { ...process.env };
@@ -897,6 +906,9 @@ describe('AIServicePlugin', () => {
897906
);
898907
} finally {
899908
process.env = oldEnv;
909+
vi.doUnmock('@ai-sdk/openai');
910+
vi.doUnmock('@ai-sdk/anthropic');
911+
vi.doUnmock('@ai-sdk/google');
900912
}
901913
});
902914

0 commit comments

Comments
 (0)