-
Notifications
You must be signed in to change notification settings - Fork 1
Fix CI build and test errors #952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -127,10 +127,11 @@ describe('Next.js Metadata API Integration Tests', () => { | |
| expect(res.status).toBe(200); | ||
| expect(res.body.data).toHaveLength(2); | ||
| expect(mockDispatcher.dispatch).toHaveBeenCalledWith( | ||
| 'objects', | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| 'GET', | ||
| '/meta/objects', | ||
| undefined, | ||
| {}, | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| ); | ||
| }); | ||
| }); | ||
|
|
@@ -153,10 +154,11 @@ describe('Next.js Metadata API Integration Tests', () => { | |
| expect(res.status).toBe(200); | ||
| expect(res.body.data.name).toBe('account'); | ||
| expect(mockDispatcher.dispatch).toHaveBeenCalledWith( | ||
| 'objects/account', | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| 'GET', | ||
| '/meta/objects/account', | ||
| undefined, | ||
| {}, | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| ); | ||
|
Comment on lines
+158
to
162
|
||
| }); | ||
| }); | ||
|
|
@@ -178,10 +180,11 @@ describe('Next.js Metadata API Integration Tests', () => { | |
| const res = await handler(req, { params: { objectstack: ['meta', 'objects'] } }); | ||
| expect(res.status).toBe(201); | ||
| expect(mockDispatcher.dispatch).toHaveBeenCalledWith( | ||
| 'objects', | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| 'POST', | ||
| '/meta/objects', | ||
| body, | ||
| {}, | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| ); | ||
|
Comment on lines
+184
to
188
|
||
| }); | ||
| }); | ||
|
|
@@ -199,10 +202,11 @@ describe('Next.js Metadata API Integration Tests', () => { | |
| const res = await handler(req, { params: { objectstack: ['meta', 'objects', 'account'] } }); | ||
| expect(res.status).toBe(200); | ||
| expect(mockDispatcher.dispatch).toHaveBeenCalledWith( | ||
| 'objects/account', | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| 'PUT', | ||
| '/meta/objects/account', | ||
| body, | ||
| {}, | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| ); | ||
|
Comment on lines
+206
to
210
|
||
| }); | ||
| }); | ||
|
|
@@ -229,32 +233,35 @@ describe('Next.js Metadata API Integration Tests', () => { | |
| const req = makeReq('http://localhost/api/meta/views'); | ||
| await handler(req, { params: { objectstack: ['meta', 'views'] } }); | ||
| expect(mockDispatcher.dispatch).toHaveBeenCalledWith( | ||
| 'views', | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| 'GET', | ||
| '/meta/views', | ||
| undefined, | ||
| {}, | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| ); | ||
|
Comment on lines
+237
to
241
|
||
| }); | ||
|
|
||
| it('dispatches for flows', async () => { | ||
| const req = makeReq('http://localhost/api/meta/flows'); | ||
| await handler(req, { params: { objectstack: ['meta', 'flows'] } }); | ||
| expect(mockDispatcher.dispatch).toHaveBeenCalledWith( | ||
| 'flows', | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| 'GET', | ||
| '/meta/flows', | ||
| undefined, | ||
| {}, | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| ); | ||
|
Comment on lines
+249
to
253
|
||
| }); | ||
|
|
||
| it('dispatches for agents', async () => { | ||
| const req = makeReq('http://localhost/api/meta/agents'); | ||
| await handler(req, { params: { objectstack: ['meta', 'agents'] } }); | ||
| expect(mockDispatcher.dispatch).toHaveBeenCalledWith( | ||
| 'agents', | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| 'GET', | ||
| '/meta/agents', | ||
| undefined, | ||
| {}, | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| ); | ||
|
Comment on lines
+261
to
265
|
||
| }); | ||
| }); | ||
|
|
@@ -684,10 +691,11 @@ describe('Next.js Metadata API Integration Tests', () => { | |
| const req = makeReq('http://localhost/api/meta/objects/account/fields/name'); | ||
| await handler(req, { params: { objectstack: ['meta', 'objects', 'account', 'fields', 'name'] } }); | ||
| expect(mockDispatcher.dispatch).toHaveBeenCalledWith( | ||
| 'objects/account/fields/name', | ||
| expect.any(Object), | ||
| 'GET', | ||
| '/meta/objects/account/fields/name', | ||
| undefined, | ||
| {}, | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| ); | ||
|
Comment on lines
+695
to
699
|
||
| }); | ||
|
|
||
|
|
@@ -696,10 +704,11 @@ describe('Next.js Metadata API Integration Tests', () => { | |
| // With just ['meta'], subPath becomes empty after slice(1) | ||
| await handler(req, { params: { objectstack: ['meta'] } }); | ||
| expect(mockDispatcher.dispatch).toHaveBeenCalledWith( | ||
| '', | ||
| expect.any(Object), | ||
| 'GET', | ||
| '/meta', | ||
| undefined, | ||
| {}, | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| ); | ||
|
Comment on lines
+708
to
712
|
||
| }); | ||
| }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -299,6 +299,7 @@ describe('AuthPlugin', () => { | |
| baseUrl: 'http://localhost:3000', | ||
| }); | ||
| mockContext.hook = localHookCapture.hookFn; | ||
| (mockContext.registerService as any).mockClear(); | ||
| await localPlugin.init(mockContext); | ||
|
|
||
| const mockRawApp = { all: vi.fn() }; | ||
|
|
@@ -314,7 +315,7 @@ describe('AuthPlugin', () => { | |
| throw new Error(`Service not found: ${name}`); | ||
| }); | ||
|
|
||
| const registeredAuthManager = (mockContext.registerService as any).mock.calls.at(-1)[1]; | ||
| const registeredAuthManager = (mockContext.registerService as any).mock.calls[0][1]; | ||
| const setRuntimeSpy = vi.spyOn(registeredAuthManager, 'setRuntimeBaseUrl'); | ||
|
|
||
|
Comment on lines
+318
to
320
|
||
| await localPlugin.start(mockContext); | ||
|
|
@@ -330,6 +331,7 @@ describe('AuthPlugin', () => { | |
| secret: 'test-secret-at-least-32-chars-long', | ||
| }); | ||
| mockContext.hook = localHookCapture.hookFn; | ||
| (mockContext.registerService as any).mockClear(); | ||
| await localPlugin.init(mockContext); | ||
|
|
||
| const mockRawApp = { all: vi.fn() }; | ||
|
|
@@ -345,7 +347,7 @@ describe('AuthPlugin', () => { | |
| throw new Error(`Service not found: ${name}`); | ||
| }); | ||
|
|
||
| const registeredAuthManager = (mockContext.registerService as any).mock.calls.at(-1)[1]; | ||
| const registeredAuthManager = (mockContext.registerService as any).mock.calls[0][1]; | ||
| const setRuntimeSpy = vi.spyOn(registeredAuthManager, 'setRuntimeBaseUrl'); | ||
|
|
||
|
Comment on lines
+350
to
352
|
||
| await localPlugin.start(mockContext); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 4th arg to
dispatch()is the parsed query params object. Asserting it equals{}is a bit brittle and is inconsistent withpackages/adapters/nextjs/src/nextjs.test.ts, which usesexpect.any(Object)for that argument. Consider usingexpect.any(Object)(orexpect.objectContaining({})) here to keep the test resilient if query parsing changes (e.g. default params added).