File size: 1,608 Bytes
21dd449 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
import { describe, expect, it } from "vitest";
import { datasetInfo } from "./dataset-info";
import type { DatasetEntry } from "./list-datasets";
import type { ApiDatasetInfo } from "../types/api/api-dataset";
describe("datasetInfo", () => {
it("should return the dataset info", async () => {
const info = await datasetInfo({
name: "nyu-mll/glue",
});
expect(info).toEqual({
id: "621ffdd236468d709f181e3f",
downloads: expect.any(Number),
gated: false,
name: "nyu-mll/glue",
updatedAt: expect.any(Date),
likes: expect.any(Number),
private: false,
});
});
it("should return the dataset info with author", async () => {
const info: DatasetEntry & Pick<ApiDatasetInfo, "author"> = await datasetInfo({
name: "nyu-mll/glue",
additionalFields: ["author"],
});
expect(info).toEqual({
id: "621ffdd236468d709f181e3f",
downloads: expect.any(Number),
gated: false,
name: "nyu-mll/glue",
updatedAt: expect.any(Date),
likes: expect.any(Number),
private: false,
author: "nyu-mll",
});
});
it("should return the dataset info for a specific revision", async () => {
const info: DatasetEntry & Pick<ApiDatasetInfo, "sha"> = await datasetInfo({
name: "nyu-mll/glue",
revision: "cb2099c76426ff97da7aa591cbd317d91fb5fcb7",
additionalFields: ["sha"],
});
expect(info).toEqual({
id: "621ffdd236468d709f181e3f",
downloads: expect.any(Number),
gated: false,
name: "nyu-mll/glue",
updatedAt: expect.any(Date),
likes: expect.any(Number),
private: false,
sha: "cb2099c76426ff97da7aa591cbd317d91fb5fcb7",
});
});
});
|