Skip to content

Commit 6698e41

Browse files
test(maintenance-worker): update settings access in processNip05Reverifications tests
1 parent 032a4a1 commit 6698e41

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

test/unit/app/maintenance-worker.spec.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,15 @@ describe('MaintenanceWorker', () => {
202202

203203
describe('processNip05Reverifications', () => {
204204
it('returns early when nip05 settings are undefined', async () => {
205-
;(settings as any).nip05 = undefined
205+
settingsState.nip05 = undefined
206206

207207
await (worker as any).processNip05Reverifications(settingsState)
208208

209209
expect(nip05VerificationRepository.findPendingVerifications).not.to.have.been.called
210210
})
211211

212212
it('returns early when mode is disabled', async () => {
213-
;(settings as any).nip05.mode = 'disabled'
213+
settingsState.nip05!.mode = 'disabled'
214214

215215
await (worker as any).processNip05Reverifications(settingsState)
216216

@@ -286,25 +286,25 @@ describe('MaintenanceWorker', () => {
286286
})
287287

288288
it('uses configured updateFrequency and maxFailures', async () => {
289-
;(settings as any).nip05.verifyUpdateFrequency = 3600000
290-
;(settings as any).nip05.maxConsecutiveFailures = 5
289+
settingsState.nip05!.verifyUpdateFrequency = 3600000
290+
settingsState.nip05!.maxConsecutiveFailures = 5
291291

292292
await (worker as any).processNip05Reverifications(settingsState)
293293

294294
expect(nip05VerificationRepository.findPendingVerifications).to.have.been.calledOnceWithExactly(3600000, 5, 50)
295295
})
296296

297297
it('uses defaults when settings values are undefined', async () => {
298-
;(settings as any).nip05.verifyUpdateFrequency = undefined
299-
;(settings as any).nip05.maxConsecutiveFailures = undefined
298+
settingsState.nip05!.verifyUpdateFrequency = undefined
299+
settingsState.nip05!.maxConsecutiveFailures = undefined
300300

301301
await (worker as any).processNip05Reverifications(settingsState)
302302

303303
expect(nip05VerificationRepository.findPendingVerifications).to.have.been.calledOnceWithExactly(86400000, 20, 50)
304304
})
305305

306306
it('processes in passive mode', async () => {
307-
;(settings as any).nip05.mode = 'passive'
307+
settingsState.nip05!.mode = 'passive'
308308
const row = verification({ pubkey: 'c'.repeat(64), nip05: 'charlie@example.com' })
309309
nip05VerificationRepository.findPendingVerifications.resolves([row])
310310
verifyStub.resolves({ status: 'verified' })
@@ -318,7 +318,7 @@ describe('MaintenanceWorker', () => {
318318

319319
describe('onSchedule', () => {
320320
it('calls maintenance service and processes invoices', async () => {
321-
;(settings as any).payments = { enabled: true }
321+
settingsState.payments = { enabled: true } as any
322322
maintenanceService.clearOldEvents.resolves()
323323
paymentsService.getPendingInvoices.resolves([])
324324

@@ -329,7 +329,7 @@ describe('MaintenanceWorker', () => {
329329
})
330330

331331
it('calls maintenance service even if payments are disabled', async () => {
332-
;(settings as any).payments = { enabled: false }
332+
settingsState.payments = { enabled: false } as any
333333
maintenanceService.clearOldEvents.resolves()
334334

335335
await (worker as any).onSchedule()

0 commit comments

Comments
 (0)