Skip to content

Conversation

@mattapperson
Copy link
Collaborator

Summary

  • Add initial E2E tests for chat and models endpoints
  • Add test configuration with vitest
  • Add E2E testing documentation

Test plan

  • Review test coverage
  • Fix failing tests if any
  • Ensure tests pass in CI

@mattapperson mattapperson marked this pull request as draft October 28, 2025 01:38
- Create composite action for SDK validation steps (build, typecheck, tests)
- Update speakeasy workflow to use composite action
- Add new PR validation workflow that runs on non-OpenAPI changes
- Create reusable validation-checks workflow for shared logic

- Tests make real API calls to OpenRouter, so you need a valid API key
- Tests may consume API credits
- Some tests use the `openai/gpt-3.5-turbo` model by default
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: should we replace gpt-3.5-turbo openai/gpt-4.1-nano. gpt-3.5-turbo will be deprecated in a year. Also it's more expensive than nano.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

actually, would meta-llama/llama-3.2-1b-instruct be better/cheaper/faster to run?

- Fetching the list of available models
- Validating model properties
- Filtering models by category
- Getting the total count of models
Copy link
Contributor

Choose a reason for hiding this comment

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

should we add one test where we intentionally garble the openrouter key or ask for an invalid model so that we can check that the error parsing works correctly?

@@ -0,0 +1,59 @@
import { beforeAll, describe, expect, it } from "vitest";
import { OpenRouter } from "../../src/sdk/sdk.js";

Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

}
}

expect(foundFinishReason).toBe(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's also add a usage check to this test.

Copy link
Contributor

@yogasanas yogasanas 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 great!

@mattapperson mattapperson merged commit a3f7af0 into main Oct 28, 2025
2 of 3 checks passed
@mattapperson mattapperson deleted the fix/move-e2e-tests branch October 28, 2025 20:56
});

it("should return models with expected properties", async () => {
const response = await client.models.list();

Choose a reason for hiding this comment

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

we will eventually need to paginate this API, and may be able to do it without versioning the api. should we have the SDK prep for it?

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.

4 participants