Skip to content

Commit bd6903a

Browse files
committed
Clean up lint errors in new api/cron/cleanup job
1 parent 9b10ae1 commit bd6903a

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

@types/virtual-pwa-register.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ declare module 'virtual:pwa-register' {
33
immediate?: boolean
44
onNeedRefresh?: () => void
55
onOfflineReady?: () => void
6-
onRegistered?: (registration: ServiceWorkerRegistration | undefined) => void
7-
onRegisterError?: (error: Error) => void
6+
onRegistered?: (_registration: ServiceWorkerRegistration | undefined) => void
7+
onRegisterError?: (_error: Error) => void
88
}
99

10-
export function registerSW(options?: RegisterSWOptions): (reloadPage?: boolean) => Promise<void>
10+
export function registerSW(_options?: RegisterSWOptions): (_reloadPage?: boolean) => Promise<void>
1111
}

src/pages/api/cron/__tests__/cleanup.spec.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,13 @@ describe('Cron cleanup endpoints', () => {
219219

220220
let fetchMock: ReturnType<typeof vi.fn>
221221

222-
const buildRequest = (headers?: HeadersInit) =>
223-
new Request('http://localhost/api/cron/ping-integrations', {
224-
method: 'GET',
225-
headers,
226-
})
222+
const buildRequest = (headers?: HeadersInit) => {
223+
const init: RequestInit = { method: 'GET' }
224+
if (typeof headers !== 'undefined') {
225+
init.headers = headers
226+
}
227+
return new Request('http://localhost/api/cron/ping-integrations', init)
228+
}
227229

228230
const createFetchResponse = (overrides?: Partial<Response>): Response => ({
229231
ok: true,
@@ -281,7 +283,7 @@ describe('Cron cleanup endpoints', () => {
281283

282284
const fetchArgs = fetchMock.mock.calls[0]![1] as RequestInit | undefined
283285
const headers = fetchArgs?.headers as Record<string, string> | undefined
284-
expect(headers?.Authorization ?? headers?.authorization).toBe('Bearer upstash-token')
286+
expect(headers?.['Authorization'] ?? headers?.['authorization']).toBe('Bearer upstash-token')
285287
})
286288

287289
it('returns upstream error details when Upstash responds with failure', async () => {

0 commit comments

Comments
 (0)