Skip to content

Commit 3e9dca9

Browse files
committed
chore: wip
1 parent ab22d6b commit 3e9dca9

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

test/minimum-release-age-integration.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ jobs:
8383
const buddy = new Buddy(config, testDir)
8484

8585
// Test the configuration is properly loaded
86-
expect(buddy.config.packages?.minimumReleaseAge).toBe(1440)
87-
expect(buddy.config.packages?.minimumReleaseAgeExclude).toEqual(['webpack', 'actions/checkout'])
86+
expect((buddy as any).config.packages?.minimumReleaseAge).toBe(1440)
87+
expect((buddy as any).config.packages?.minimumReleaseAgeExclude).toEqual(['webpack', 'actions/checkout'])
8888

8989
console.log('\n✅ Configuration loaded successfully')
9090
console.log('📋 Test project structure created with:')
@@ -94,18 +94,18 @@ jobs:
9494

9595
// The actual scanning would require network calls, so we'll just verify
9696
// that the filtering logic is properly integrated
97-
const registryClient = buddy.registryClient
97+
const registryClient = (buddy as any).registryClient
9898

9999
// Test that the registry client has the correct configuration
100-
expect(registryClient.config?.packages?.minimumReleaseAge).toBe(1440)
101-
expect(registryClient.config?.packages?.minimumReleaseAgeExclude).toEqual(['webpack', 'actions/checkout'])
100+
expect((registryClient as any).config?.packages?.minimumReleaseAge).toBe(1440)
101+
expect((registryClient as any).config?.packages?.minimumReleaseAgeExclude).toEqual(['webpack', 'actions/checkout'])
102102

103103
console.log('\n🔧 Registry client configured with minimum release age settings')
104104
console.log('🛡️ Security feature active: packages must be 24+ hours old')
105105
console.log('⚡ Trusted packages (webpack, actions/checkout) bypass the requirement')
106106

107107
// Test the filtering method exists and works
108-
const filterMethod = buddy.filterUpdatesByMinimumReleaseAge
108+
const filterMethod = (buddy as any).filterUpdatesByMinimumReleaseAge
109109
expect(typeof filterMethod).toBe('function')
110110

111111
console.log('\n✅ Integration test completed successfully!')

test/minimum-release-age.test.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ describe('Minimum Release Age Functionality', () => {
213213
const buddy = new Buddy(config, testDir)
214214

215215
// Mock the registry client's meetsMinimumReleaseAge method
216-
const originalMethod = buddy.registryClient.meetsMinimumReleaseAge
217-
buddy.registryClient.meetsMinimumReleaseAge = mock(async (packageName: string, _version: string, _dependencyType?: string) => {
216+
const originalMethod = (buddy as any).registryClient.meetsMinimumReleaseAge
217+
;(buddy as any).registryClient.meetsMinimumReleaseAge = mock(async (packageName: string, _version: string, _dependencyType?: string) => {
218218
// Simulate different packages with different ages
219219
if (packageName === 'old-package')
220220
return true
@@ -253,14 +253,14 @@ describe('Minimum Release Age Functionality', () => {
253253
]
254254

255255
// Call the private method using bracket notation
256-
const filteredUpdates = await buddy.filterUpdatesByMinimumReleaseAge(mockUpdates)
256+
const filteredUpdates = await (buddy as any).filterUpdatesByMinimumReleaseAge(mockUpdates)
257257

258258
// Should only include old-package and trusted-package
259259
expect(filteredUpdates).toHaveLength(2)
260-
expect(filteredUpdates.map(u => u.name)).toEqual(['old-package', 'trusted-package'])
260+
expect(filteredUpdates.map((u: PackageUpdate) => u.name)).toEqual(['old-package', 'trusted-package'])
261261

262262
// Restore original method
263-
buddy.registryClient.meetsMinimumReleaseAge = originalMethod
263+
;(buddy as any).registryClient.meetsMinimumReleaseAge = originalMethod
264264
})
265265

266266
it('should return all updates when minimumReleaseAge is 0', async () => {
@@ -292,7 +292,7 @@ describe('Minimum Release Age Functionality', () => {
292292
},
293293
]
294294

295-
const filteredUpdates = await buddy.filterUpdatesByMinimumReleaseAge(mockUpdates)
295+
const filteredUpdates = await (buddy as any).filterUpdatesByMinimumReleaseAge(mockUpdates)
296296

297297
// Should return all updates when disabled
298298
expect(filteredUpdates).toHaveLength(2)
@@ -310,7 +310,7 @@ describe('Minimum Release Age Functionality', () => {
310310
const buddy = new Buddy(config, testDir)
311311

312312
// Mock the registry client to simulate different behaviors for different types
313-
buddy.registryClient.meetsMinimumReleaseAge = mock(async (packageName: string, version: string, dependencyType?: string) => {
313+
;(buddy as any).registryClient.meetsMinimumReleaseAge = mock(async (packageName: string, version: string, dependencyType?: string) => {
314314
// Simulate that npm packages are too new, but GitHub Actions are old enough
315315
if (dependencyType === 'dependencies')
316316
return false
@@ -348,11 +348,11 @@ describe('Minimum Release Age Functionality', () => {
348348
},
349349
]
350350

351-
const filteredUpdates = await buddy.filterUpdatesByMinimumReleaseAge(mockUpdates)
351+
const filteredUpdates = await (buddy as any).filterUpdatesByMinimumReleaseAge(mockUpdates)
352352

353353
// Should only include GitHub Actions and Composer packages
354354
expect(filteredUpdates).toHaveLength(2)
355-
expect(filteredUpdates.map(u => u.name)).toEqual(['actions/checkout', 'laravel/framework'])
355+
expect(filteredUpdates.map((u: PackageUpdate) => u.name)).toEqual(['actions/checkout', 'laravel/framework'])
356356
})
357357
})
358358

@@ -381,7 +381,7 @@ describe('Minimum Release Age Functionality', () => {
381381
const buddy = new Buddy(config, testDir)
382382

383383
// Mock the registry client methods to avoid actual network calls
384-
buddy.registryClient.getOutdatedPackages = mock(async () => [
384+
;(buddy as any).registryClient.getOutdatedPackages = mock(async () => [
385385
{
386386
name: 'react',
387387
currentVersion: '17.0.0',
@@ -401,12 +401,12 @@ describe('Minimum Release Age Functionality', () => {
401401
])
402402

403403
// Mock other update checking methods to return empty arrays
404-
buddy.checkDependencyFilesForUpdates = mock(async () => [])
405-
buddy.checkGitHubActionsForUpdates = mock(async () => [])
406-
buddy.checkDockerfilesForUpdates = mock(async () => [])
404+
;(buddy as any).checkDependencyFilesForUpdates = mock(async () => [])
405+
;(buddy as any).checkGitHubActionsForUpdates = mock(async () => [])
406+
;(buddy as any).checkDockerfilesForUpdates = mock(async () => [])
407407

408408
// Mock minimum release age checking
409-
buddy.registryClient.meetsMinimumReleaseAge = mock(async (packageName: string) => {
409+
;(buddy as any).registryClient.meetsMinimumReleaseAge = mock(async (packageName: string) => {
410410
// Only allow typescript (simulate react being too new)
411411
return packageName === 'typescript'
412412
})

0 commit comments

Comments
 (0)