Skip to content

Commit bd23ccc

Browse files
committed
fix: test code
1 parent de8b647 commit bd23ccc

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

tests-ui/tests/services/assetService.test.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ describe('assetService', () => {
297297
const result = await assetService.getAssetsByTag('models')
298298

299299
expect(api.fetchApi).toHaveBeenCalledWith(
300-
'/assets?include_tags=models&limit=500'
300+
'/assets?include_tags=models&limit=500&include_public=true'
301301
)
302302
expect(result).toEqual(testAssets)
303303
})
@@ -355,5 +355,29 @@ describe('assetService', () => {
355355
expect(result[0]).toHaveProperty('asset_hash', 'blake3:full123')
356356
expect(result[0]).toHaveProperty('user_metadata')
357357
})
358+
359+
it('should exclude public assets when includePublic is false', async () => {
360+
const testAssets = [MOCK_ASSETS.checkpoints]
361+
mockApiResponse(testAssets)
362+
363+
const result = await assetService.getAssetsByTag('input', false)
364+
365+
expect(api.fetchApi).toHaveBeenCalledWith(
366+
'/assets?include_tags=input&limit=500&include_public=false'
367+
)
368+
expect(result).toEqual(testAssets)
369+
})
370+
371+
it('should include public assets when includePublic is true', async () => {
372+
const testAssets = [MOCK_ASSETS.checkpoints, MOCK_ASSETS.loras]
373+
mockApiResponse(testAssets)
374+
375+
const result = await assetService.getAssetsByTag('models', true)
376+
377+
expect(api.fetchApi).toHaveBeenCalledWith(
378+
'/assets?include_tags=models&limit=500&include_public=true'
379+
)
380+
expect(result).toEqual(testAssets)
381+
})
358382
})
359383
})

0 commit comments

Comments
 (0)