Skip to content

Conversation

@7hokerz
Copy link
Contributor

@7hokerz 7hokerz commented Jan 30, 2026

Description here... Help the reviewer by:

  • Added unit tests for the audio module to improve test coverage of audio.ts.

The tests were written to closely follow the existing test conventions and patterns used in the repository, in order to keep consistency with the current test suite and reduce review overhead.

Test result:

  • Before
 PASS  tests/utils_test.ts     
 PASS  tests/openai_test.ts        
 PASS  tests/compat_oai_test.ts (5.321 s)
------------------------|---------|----------|---------|---------|---------------------------------
File                    | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
------------------------|---------|----------|---------|---------|---------------------------------
All files               |   94.69 |    84.21 |   97.22 |   95.06 |                                 
 src                    |      95 |    84.03 |   96.15 |    95.5 |                                 
  model.ts              |   94.57 |    83.03 |   95.83 |   95.12 | 197,354,492,604,623-624,711-712 
  utils.ts              |     100 |      100 |     100 |     100 |                                 
 tests                  |   93.47 |    85.71 |     100 |   93.33 |                                 
  fake_openai_server.ts |   93.47 |    85.71 |     100 |   93.33 | 69-80
------------------------|---------|----------|---------|---------|---------------------------------

Test Suites: 3 passed, 3 total
Tests:       65 passed, 65 total
Snapshots:   0 total
Time:        6.161 s
Ran all test suites.
  • After
 PASS  tests/utils_test.ts
 PASS  tests/openai_test.ts
 PASS  tests/openai_audio_test.ts    
 PASS  tests/compat_oai_test.ts
 PASS  tests/compat_oai_audio_test.ts (5.641 s)
------------------------|---------|----------|---------|---------|---------------------------------
File                    | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
------------------------|---------|----------|---------|---------|---------------------------------
All files               |   94.64 |    83.33 |   93.47 |   94.93 |                                 
 src                    |   94.86 |    83.13 |   91.66 |   95.21 |                                 
  audio.ts              |   94.52 |    80.85 |      80 |   94.52 | 240-241,413-414                 
  model.ts              |   94.57 |    83.03 |   95.83 |   95.12 | 197,354,492,604,623-624,711-712 
  utils.ts              |     100 |      100 |     100 |     100 |                                 
 tests                  |   93.47 |    85.71 |     100 |   93.33 |                                 
  fake_openai_server.ts |   93.47 |    85.71 |     100 |   93.33 | 69-80
------------------------|---------|----------|---------|---------|---------------------------------

Test Suites: 5 passed, 5 total
Tests:       82 passed, 82 total
Snapshots:   0 total
Time:        6.514 s
Ran all test suites.

If there are any missing cases or areas that should be adjusted to better match the project's testing practices, feedback would be appreciated!

Checklist (if applicable):

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @7hokerz, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on bolstering the testing infrastructure for the compat-oai plugin's audio module. By introducing dedicated unit tests for audio request transformations, response handling, and model definitions, the changes aim to increase the reliability and maintainability of the audio functionalities. The modifications also involve making key internal functions accessible for testing purposes.

Highlights

  • Enhanced Test Coverage: Comprehensive unit tests have been added for the audio.ts module, significantly improving test coverage for both Text-to-Speech (TTS) and Speech-to-Text (STT) functionalities.
  • Exported Utility Functions: Several internal utility functions within js/plugins/compat-oai/src/audio.ts, such as toTTSRequest, speechToGenerateResponse, toSttRequest, and transcriptionToGenerateResponse, have been exported to facilitate thorough unit testing and potential external use.
  • Model Definition Verification: New tests ensure that defineCompatOpenAISpeechModel and defineCompatOpenAITranscriptionModel correctly define and report the capabilities (e.g., media support, output formats) of OpenAI audio models within the framework.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

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

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 significantly improves the test coverage for the audio module by introducing new unit tests for both Text-to-Speech (TTS) and Speech-to-Text (STT) functionalities. The changes in src/audio.ts to export previously internal functions are well-justified by the new test files, enabling better testability. The new test files, compat_oai_audio_test.ts and openai_audio_test.ts, are well-structured and cover a good range of scenarios, including various request configurations, error handling, and custom request builders. This is a valuable addition to the codebase, enhancing reliability and maintainability.

Copy link
Contributor

@xavidop xavidop left a comment

Choose a reason for hiding this comment

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

this is really good!

@pavelgj pavelgj requested a review from ssbushi February 1, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants