Skip to content

test(ts-sdk): replace duplicate datasets test with real dataset coverage#4032

Open
sushaan-k wants to merge 1 commit into
devflowinc:mainfrom
sushaan-k:aarya/fix-datasets-test-copy-paste
Open

test(ts-sdk): replace duplicate datasets test with real dataset coverage#4032
sushaan-k wants to merge 1 commit into
devflowinc:mainfrom
sushaan-k:aarya/fix-datasets-test-copy-paste

Conversation

@sushaan-k
Copy link
Copy Markdown

@sushaan-k sushaan-k commented May 18, 2026

clients/ts-sdk/src/functions/datasets/datasets.test.ts on main is a verbatim copy of events.test.ts: same describe("Events Tests") block, same getEventsForDataset({}) body, same EventReturn type assertion. None of the 14 functions exported by functions/datasets/index.ts are actually exercised, so the datasets module shows up as "tested" without having any coverage at all.

This PR rewrites the file to actually test the datasets module, using the same expectTypeOf pattern as chunkGroup.test.ts, analytics.test.ts, etc.

Added coverage:

  • getDatasetById
  • getDatasetUsageById
  • getDatasetsFromOrganization
  • getAllDatasetTags
  • getDatasetQueueLengths

The destructive functions (createDataset, updateDataset, batchCreateDatasets, clearDataset, deleteDataset) are intentionally not in here. Running them on every PR against the shared sandbox dataset would either leak data or wipe fixtures the rest of the test files rely on.

yarn build and yarn lint both pass.

Copilot AI review requested due to automatic review settings May 18, 2026 03:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 getEventsForDataset type 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!);
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), so the datasets module had zero coverage.

This rewrites the file to test the datasets module. The selected calls are
read-only (no datasets 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
@sushaan-k sushaan-k force-pushed the aarya/fix-datasets-test-copy-paste branch from df94f0b to 3a9db60 Compare May 18, 2026 21:16
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.

2 participants