Skip to content

Commit 4e3da78

Browse files
fix(hub): test list datasets (#1567)
Hello there 👋 It's my first time contributing. I tried to set up the project with `pnpm` and got error when running the tests: ```bash ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯ │ FAIL src/lib/list-datasets.spec.ts > listDatasets > should list datasets from hf-doc-builder │ AssertionError: expected [ { …(7) }, { …(7) } ] to deeply equal [ { …(7) }, { …(7) } ] │ - Expected │ + Received │ Array [ │ Object { │ "downloads": 0, │ "gated": false, │ - "id": "6356b19985da6f13863228bd", │ + "id": "636a1b69f2f9ec4289c4c19e", │ "likes": 0, │ - "name": "hf-doc-build/doc-build", │ + "name": "hf-doc-build/doc-build-dev", │ "private": false, │ "updatedAt": 1970-01-01T00:00:00.000Z, │ }, │ Object { │ "downloads": 0, │ "gated": false, │ - "id": "636a1b69f2f9ec4289c4c19e", │ + "id": "6356b19985da6f13863228bd", │ "likes": 0, │ - "name": "hf-doc-build/doc-build-dev", │ + "name": "hf-doc-build/doc-build", │ "private": false, │ "updatedAt": 1970-01-01T00:00:00.000Z, │ }, │ ] │ ❯ src/lib/list-datasets.spec.ts:26:24 │ 24| } │ 25| │ 26| expect(results).deep.equal([ │ | ^ │ 27| { │ 28| id: "6356b19985da6f13863228bd", │ ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ │ Test Files 1 failed | 39 passed (40) │ Tests 1 failed | 135 passed (136) │ Start at 02:32:04 │ Duration 14.37s (transform 650ms, setup 3ms, collect 2.44s, tests 65.94s, environment 3ms, prepare 2.74s) ``` So I fix it. --------- Co-authored-by: Eliott C. <coyotte508@gmail.com>
1 parent 13becc9 commit 4e3da78

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/hub/src/lib/list-datasets.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe("listDatasets", () => {
77
const results: DatasetEntry[] = [];
88

99
for await (const entry of listDatasets({ search: { owner: "hf-doc-build" } })) {
10-
if (entry.name === "hf-doc-build/doc-build-dev-test") {
10+
if (entry.name !== "hf-doc-build/doc-build" && entry.name !== "hf-doc-build/doc-build-dev") {
1111
continue;
1212
}
1313
if (typeof entry.downloads === "number") {
@@ -23,7 +23,7 @@ describe("listDatasets", () => {
2323
results.push(entry);
2424
}
2525

26-
expect(results).deep.equal([
26+
expect(results.sort((a, b) => a.id.localeCompare(b.id))).to.deep.equal([
2727
{
2828
id: "6356b19985da6f13863228bd",
2929
name: "hf-doc-build/doc-build",

0 commit comments

Comments
 (0)