Skip to content

🧪 testing improvement: add tests for createDAPClient#24

Open
anusornc wants to merge 1 commit into
mainfrom
add-create-dap-client-tests-6064820282345168533
Open

🧪 testing improvement: add tests for createDAPClient#24
anusornc wants to merge 1 commit into
mainfrom
add-create-dap-client-tests-6064820282345168533

Conversation

@anusornc

@anusornc anusornc commented Jun 9, 2026

Copy link
Copy Markdown
Owner

🎯 What: Added missing unit tests for the createDAPClient factory function in test/dap-client.test.ts.

📊 Coverage: Covered creating the client with the provided config, ensuring the factory function correctly initializes the DAPClient instance, maps over the necessary config attributes, and properly sets default values.

Result: Improved test coverage for src/client/dap-client.ts, addressing the gap where createDAPClient had no explicit tests.


PR created automatically by Jules for task 6064820282345168533 started by @anusornc

Co-authored-by: anusornc <11565019+anusornc@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces unit tests for the createDAPClient function in test/dap-client.test.ts to verify that it correctly instantiates a DAPClient with default and overridden configuration values. The review feedback suggests avoiding the use of as any when accessing private configuration properties to maintain TypeScript type safety, recommending a safer type casting approach instead.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread test/dap-client.test.ts
Comment on lines +53 to +55
expect((client as any).config.relayUrl).toBe('ws://localhost:3000');
expect((client as any).config.reconnectIntervalMs).toBe(5000); // Check default values
expect((client as any).config.requestTimeoutMs).toBe(60000); // Check default values

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using as any to access private properties disables all TypeScript type checking for the rest of the expression. If DAPClientConfig properties are renamed or refactored in the future, this test will compile successfully but might fail at runtime or assert incorrect properties silently.

By casting to unknown and then to an object with a typed config property, we preserve type safety for the configuration fields.

    const clientConfig = (client as unknown as { config: DAPClientConfig }).config;
    expect(clientConfig.relayUrl).toBe('ws://localhost:3000');
    expect(clientConfig.reconnectIntervalMs).toBe(5000); // Check default values
    expect(clientConfig.requestTimeoutMs).toBe(60000); // Check default values

Comment thread test/dap-client.test.ts
Comment on lines +69 to +70
expect((client as any).config.reconnectIntervalMs).toBe(1000);
expect((client as any).config.requestTimeoutMs).toBe(10000);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Avoid using as any here to maintain type safety for the configuration properties during future refactoring.

    const clientConfig = (client as unknown as { config: DAPClientConfig }).config;
    expect(clientConfig.reconnectIntervalMs).toBe(1000);
    expect(clientConfig.requestTimeoutMs).toBe(10000);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant