test(ts-sdk): replace duplicate datasets test with real dataset coverage#4032
Open
sushaan-k wants to merge 1 commit into
Open
test(ts-sdk): replace duplicate datasets test with real dataset coverage#4032sushaan-k wants to merge 1 commit into
sushaan-k wants to merge 1 commit into
Conversation
…erage
The previous `clients/ts-sdk/src/functions/datasets/datasets.test.ts` was a
verbatim copy of `events.test.ts` — same `describe("Events Tests")` block,
same `getEventsForDataset` call — providing zero coverage for the 14
functions exported by the `datasets` module.
This rewrites the file to actually test the datasets module. The selected
calls are read-only (no datasets are created, modified, or deleted) so the
suite is safe to run repeatedly against the shared sandbox dataset that
backs the other ts-sdk integration tests.
Coverage added:
- `getDatasetById`
- `getDatasetUsageById`
- `getDatasetsFromOrganization`
- `getAllDatasetTags`
- `getDatasetQueueLengths`
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the TS SDK dataset tests to cover dataset-related endpoints/types instead of events.
Changes:
- Replace the prior
getEventsForDatasettype test with dataset-focused tests. - Add type-level assertions for dataset retrieval, usage, org datasets listing, tags, and queue lengths.
- Update imported generated types to match the new tests.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { test } from "../../__tests__/utils"; | ||
|
|
||
| describe("Events Tests", async () => { | ||
| describe("Dataset Tests", async () => { |
Comment on lines
+19
to
+22
| test("getDatasetById", async () => { | ||
| const data = await trieve.getDatasetById(trieve.datasetId!); | ||
| expectTypeOf(data).toEqualTypeOf<Dataset>(); | ||
| }); |
| const data = await trieve.getEventsForDataset({}); | ||
| expectTypeOf(data).toEqualTypeOf<EventReturn>(); | ||
| test("getDatasetById", async () => { | ||
| const data = await trieve.getDatasetById(trieve.datasetId!); |
| }); | ||
|
|
||
| test("getDatasetUsageById", async () => { | ||
| const data = await trieve.getDatasetUsageById(trieve.datasetId!); |
Comment on lines
+30
to
+32
| const data = await trieve.getDatasetsFromOrganization( | ||
| trieve.organizationId!, | ||
| ); |
| { | ||
| page: 1, | ||
| }, | ||
| trieve.datasetId!, |
| }); | ||
|
|
||
| test("getDatasetQueueLengths", async () => { | ||
| const data = await trieve.getDatasetQueueLengths(trieve.datasetId!); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Replaces
clients/ts-sdk/src/functions/datasets/datasets.test.ts— which was a verbatim copy ofevents.test.ts— with an actual test suite for the datasets module.Why?
datasets.test.tson `main` is identical to `events.test.ts`: same `describe("Events Tests")` block, same `getEventsForDataset({})` body, same `EventReturn` type assertion. It tests none of the 14 functions in `functions/datasets/index.ts` — so the datasets module looks tested at a glance, but in reality has zero coverage. Easy to miss, easy to regress.Changes
The destructive functions (`createDataset`, `updateDataset`, `batchCreateDatasets`, `clearDataset`, `deleteDataset`) are intentionally not included — running them on the shared sandbox dataset in CI on every PR would either leak data or wipe out the fixtures the other test files rely on.
Testing