Skip to content

Commit 85c785f

Browse files
authored
Fix failing collection tests (#1873)
Expectation: CI is green ✔️
1 parent df0d3e1 commit 85c785f

File tree

2 files changed

+25
-30
lines changed

2 files changed

+25
-30
lines changed

packages/hub/src/lib/collection-info.spec.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ describe("collectionInfo", () => {
3131
_id: "690df2a467ea25a1a346d0ae",
3232
author: "huggingfacejs",
3333
datasetsServerInfo: {
34-
formats: ["imagefolder"],
35-
libraries: ["datasets", "mlcroissant"],
36-
modalities: ["audio", "image"],
37-
numRows: 38,
38-
viewer: "viewer",
34+
formats: expect.any(Array),
35+
libraries: expect.any(Array),
36+
modalities: expect.any(Array),
37+
numRows: expect.any(Number),
38+
viewer: expect.any(String),
3939
},
4040
downloads: expect.any(Number),
4141
gated: false,
4242
id: "huggingfacejs/tasks",
4343
isLikedByUser: false,
44-
lastModified: "2025-05-21T10:59:37.000Z",
44+
lastModified: expect.any(String),
4545
likes: expect.any(Number),
4646
position: 0,
4747
private: false,
@@ -57,8 +57,7 @@ describe("collectionInfo", () => {
5757
numberItems: 5,
5858
owner: {
5959
_id: "6414d83b385a75d7790d5a58",
60-
avatarUrl:
61-
"https://cdn-avatars.huggingface.co/v1/production/uploads/1679315631188-61d2f90c3c2083e1c08af22d.png",
60+
avatarUrl: expect.any(String),
6261
followerCount: expect.any(Number),
6362
fullname: "Huggingface.js",
6463
isEnterprise: false,
@@ -83,8 +82,7 @@ describe("collectionInfo", () => {
8382
author: "huggingfacejs",
8483
authorData: {
8584
_id: "6414d83b385a75d7790d5a58",
86-
avatarUrl:
87-
"https://cdn-avatars.huggingface.co/v1/production/uploads/1679315631188-61d2f90c3c2083e1c08af22d.png",
85+
avatarUrl: expect.any(String),
8886
followerCount: expect.any(Number),
8987
fullname: "Huggingface.js",
9088
isEnterprise: false,
@@ -98,12 +96,12 @@ describe("collectionInfo", () => {
9896
colorTo: "green",
9997
createdAt: "2023-03-17T21:33:16.000Z",
10098
emoji: "🌎",
99+
featured: false,
101100
id: "huggingfacejs/push-model-from-web",
102101
isLikedByUser: false,
103-
lastModified: "2023-04-01T15:29:38.000Z",
104-
likes: expect.any(Number),
102+
lastModified: expect.any(String),
103+
likes: 1,
105104
pinned: false,
106-
featured: false,
107105
position: 2,
108106
private: false,
109107
repoType: "space",
@@ -141,8 +139,7 @@ describe("collectionInfo", () => {
141139
author: "huggingfacejs",
142140
authorData: {
143141
_id: "6414d83b385a75d7790d5a58",
144-
avatarUrl:
145-
"https://cdn-avatars.huggingface.co/v1/production/uploads/1679315631188-61d2f90c3c2083e1c08af22d.png",
142+
avatarUrl: expect.any(String),
146143
followerCount: expect.any(Number),
147144
fullname: "Huggingface.js",
148145
isEnterprise: false,
@@ -157,7 +154,7 @@ describe("collectionInfo", () => {
157154
gated: false,
158155
id: "huggingfacejs/test-model",
159156
isLikedByUser: false,
160-
lastModified: "2025-11-07T13:25:23.000Z",
157+
lastModified: expect.any(String),
161158
likes: expect.any(Number),
162159
position: 4,
163160
private: false,

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

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ describe("listCollections", () => {
4141
_id: "690df2a467ea25a1a346d0ae",
4242
author: "huggingfacejs",
4343
datasetsServerInfo: {
44-
formats: ["imagefolder"],
45-
libraries: ["datasets", "mlcroissant"],
46-
modalities: ["audio", "image"],
47-
numRows: 38,
48-
viewer: "viewer",
44+
formats: expect.any(Array),
45+
libraries: expect.any(Array),
46+
modalities: expect.any(Array),
47+
numRows: expect.any(Number),
48+
viewer: expect.any(String),
4949
},
5050
downloads: expect.any(Number),
5151
gated: false,
5252
id: "huggingfacejs/tasks",
5353
isLikedByUser: false,
54-
lastModified: "2025-05-21T10:59:37.000Z",
54+
lastModified: expect.any(String),
5555
likes: expect.any(Number),
5656
position: 0,
5757
private: false,
@@ -63,12 +63,11 @@ describe("listCollections", () => {
6363
description: "Only used in E2E tests",
6464
id: "690df2897fa1945492b8cf42",
6565
isUpvotedByUser: false,
66-
lastUpdated: "2025-11-07T13:24:26.277Z",
66+
lastUpdated: expect.any(String),
6767
numberItems: 5,
6868
owner: {
6969
_id: "6414d83b385a75d7790d5a58",
70-
avatarUrl:
71-
"https://cdn-avatars.huggingface.co/v1/production/uploads/1679315631188-61d2f90c3c2083e1c08af22d.png",
70+
avatarUrl: expect.any(String),
7271
followerCount: expect.any(Number),
7372
fullname: "Huggingface.js",
7473
isEnterprise: false,
@@ -93,8 +92,7 @@ describe("listCollections", () => {
9392
author: "huggingfacejs",
9493
authorData: {
9594
_id: "6414d83b385a75d7790d5a58",
96-
avatarUrl:
97-
"https://cdn-avatars.huggingface.co/v1/production/uploads/1679315631188-61d2f90c3c2083e1c08af22d.png",
95+
avatarUrl: expect.any(String),
9896
followerCount: expect.any(Number),
9997
fullname: "Huggingface.js",
10098
isEnterprise: false,
@@ -108,14 +106,14 @@ describe("listCollections", () => {
108106
colorTo: "green",
109107
createdAt: "2023-03-17T21:33:16.000Z",
110108
emoji: "🌎",
109+
featured: false,
111110
id: "huggingfacejs/push-model-from-web",
112111
isLikedByUser: false,
113-
lastModified: "2023-04-01T15:29:38.000Z",
114-
likes: expect.any(Number),
112+
lastModified: expect.any(String),
113+
likes: 1,
115114
pinned: false,
116115
position: 2,
117116
private: false,
118-
featured: false,
119117
repoType: "space",
120118
runtime: {
121119
hardware: {

0 commit comments

Comments
 (0)