-
Notifications
You must be signed in to change notification settings - Fork 14
Add E2E tests for SDK #35
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
Conversation
7edd54d to
7eb198a
Compare
- 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 |
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.
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.
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.
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 |
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.
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"; | |||
|
|
|||
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.
nice!
| } | ||
| } | ||
|
|
||
| expect(foundFinishReason).toBe(true); |
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.
Let's also add a usage check to this test.
yogasanas
left a comment
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.
This is great!
| }); | ||
|
|
||
| it("should return models with expected properties", async () => { | ||
| const response = await client.models.list(); |
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.
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?
Summary
Test plan