Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions packages/agent-core-v2/test/agent/mcp/tools/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ describe('createMcpAuthTool', () => {
complete: async () => undefined,
cancel: async () => undefined,
}));
const before = Date.now();
const { result, updates } = runTool({
oauthService,
reconnect: async () => {
Expand All @@ -69,11 +70,14 @@ describe('createMcpAuthTool', () => {
serverName: 'notion',
authorizationUrl: 'https://example.com/authorize?state=abc',
});
// The deadline is absolute (now + wait timeout), so hosts never mirror
// the engine-side constant.
// The deadline is absolute (emit time + the effective wait timeout — the
// 100ms override here, not the 15-minute default), so hosts render from
// data instead of mirroring the engine constant. Bounding by the time
// window around the run keeps the assertion exact without depending on
// how long the test body takes.
Comment on lines +73 to +77

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove the inline body comment

This added explanatory comment is inside a test body, but the package guidance for agent-core-v2 only allows comments in the top-of-file header and says not to place them beside functions, methods, or statements. Please move this rationale into the file header or make the assertions self-explanatory without an inline comment.

AGENTS.md reference: packages/agent-core-v2/AGENTS.md:L15-L17

Useful? React with 👍 / 👎.

const { expiresAt } = authUpdate?.customData as { expiresAt?: number };
expect(expiresAt).toBeGreaterThan(Date.now());
expect(expiresAt).toBeLessThanOrEqual(Date.now() + 15 * 60 * 1000);
expect(expiresAt).toBeGreaterThanOrEqual(before + 100);
expect(expiresAt).toBeLessThanOrEqual(Date.now() + 100);
});

it('falls through to reconnect when the provider reports already-authorized', async () => {
Expand Down
12 changes: 8 additions & 4 deletions packages/agent-core/test/mcp/auth-tool.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ describe('createMcpAuthTool', () => {
complete: async () => undefined,
cancel: async () => undefined,
}));
const before = Date.now();
const { result, updates } = runTool({
oauthService,
reconnect: async () => {
Expand All @@ -73,11 +74,14 @@ describe('createMcpAuthTool', () => {
serverName: 'notion',
authorizationUrl: 'https://example.com/authorize?state=abc',
});
// The deadline is absolute (now + wait timeout), so hosts never mirror
// the engine-side constant.
// The deadline is absolute (emit time + the effective wait timeout — the
// 100ms override here, not the 15-minute default), so hosts render from
// data instead of mirroring the engine constant. Bounding by the time
// window around the run keeps the assertion exact without depending on
// how long the test body takes.
const { expiresAt } = authUpdate?.customData as { expiresAt?: number };
expect(expiresAt).toBeGreaterThan(Date.now());
expect(expiresAt).toBeLessThanOrEqual(Date.now() + 15 * 60 * 1000);
expect(expiresAt).toBeGreaterThanOrEqual(before + 100);
expect(expiresAt).toBeLessThanOrEqual(Date.now() + 100);
});

it('falls through to reconnect when the provider reports already-authorized', async () => {
Expand Down
Loading