11import { describe , expect , it , vi , beforeEach } from 'vitest'
22import { mountSuspended } from '@nuxt/test-utils/runtime'
33import PackageVersions from '~/components/Package/Versions.vue'
4- import type { PackumentVersion } from '#shared/types'
4+ import type { SlimVersion } from '#shared/types'
55
66// Mock the fetchAllPackageVersions function
77const mockFetchAllPackageVersions = vi . fn ( )
@@ -10,30 +10,21 @@ vi.mock('~/composables/useNpmRegistry', () => ({
1010} ) )
1111
1212/**
13- * Helper to create a minimal PackumentVersion for testing
13+ * Helper to create a minimal SlimVersion for testing
1414 */
1515function createVersion (
1616 version : string ,
1717 options : {
1818 deprecated ?: string
1919 hasProvenance ?: boolean
2020 } = { } ,
21- ) : PackumentVersion {
22- const dist : Record < string , unknown > = {
23- tarball : `https://registry.npmjs.org/test-package/-/test-package-${ version } .tgz` ,
24- shasum : 'abc123' ,
25- }
26- if ( options . hasProvenance ) {
27- dist . attestations = { url : 'https://example.com' , provenance : { predicateType : 'test' } }
28- }
21+ ) : SlimVersion {
2922 return {
30- _id : `test-package@${ version } ` ,
31- _npmVersion : '10.0.0' ,
32- name : 'test-package' ,
3323 version,
34- dist,
3524 deprecated : options . deprecated ,
36- } as unknown as PackumentVersion
25+ tags : undefined ,
26+ ...( options . hasProvenance ? { hasProvenance : true } : { } ) ,
27+ } as SlimVersion
3728}
3829
3930describe ( 'PackageVersions' , ( ) => {
@@ -459,7 +450,7 @@ describe('PackageVersions', () => {
459450
460451 it ( 'shows count of hidden tagged versions' , async ( ) => {
461452 // Create more than MAX_VISIBLE_TAGS (10) dist-tags
462- const versions : Record < string , PackumentVersion > = { }
453+ const versions : Record < string , SlimVersion > = { }
463454 const distTags : Record < string , string > = { }
464455 const time : Record < string , string > = { }
465456
@@ -551,7 +542,7 @@ describe('PackageVersions', () => {
551542 describe ( 'MAX_VISIBLE_TAGS limit' , ( ) => {
552543 it ( 'limits visible tag rows to 10' , async ( ) => {
553544 // Create 15 dist-tags
554- const versions : Record < string , PackumentVersion > = { }
545+ const versions : Record < string , SlimVersion > = { }
555546 const distTags : Record < string , string > = { }
556547 const time : Record < string , string > = { }
557548
0 commit comments