diff --git a/tests/unit/services/cwmp/device_action_executor_coverage.spec.ts b/tests/unit/services/cwmp/device_action_executor_coverage.spec.ts
index 9076272..3ad9e60 100644
--- a/tests/unit/services/cwmp/device_action_executor_coverage.spec.ts
+++ b/tests/unit/services/cwmp/device_action_executor_coverage.spec.ts
@@ -83,7 +83,7 @@ describe('DeviceActionExecutor — coverage', () => {
const device = makeDevice()
device.setGpnStatus('unknown')
let capturedCallback: any
- vi.spyOn(taskQueue, 'addTask').mockImplementation((deviceId, type, props, cb) => {
+ vi.spyOn(taskQueue, 'addTask').mockImplementation((_deviceId, _type, _props, cb) => {
capturedCallback = cb
return { xml: '', taskId: 'tid-1' }
})
@@ -99,7 +99,7 @@ describe('DeviceActionExecutor — coverage', () => {
const device = makeDevice()
device.setGpnStatus('unknown')
let capturedCallback: any
- vi.spyOn(taskQueue, 'addTask').mockImplementation((deviceId, type, props, cb) => {
+ vi.spyOn(taskQueue, 'addTask').mockImplementation((_deviceId, _type, _props, cb) => {
capturedCallback = cb
return { xml: '', taskId: 'tid-2' }
})
@@ -115,7 +115,7 @@ describe('DeviceActionExecutor — coverage', () => {
const device = makeDevice()
device.setGpnStatus('unknown')
let capturedCallback: any
- vi.spyOn(taskQueue, 'addTask').mockImplementation((deviceId, type, props, cb) => {
+ vi.spyOn(taskQueue, 'addTask').mockImplementation((_deviceId, _type, _props, cb) => {
capturedCallback = cb
return { xml: '', taskId: 'tid-3' }
})
@@ -131,7 +131,7 @@ describe('DeviceActionExecutor — coverage', () => {
const device = makeDevice()
device.setGpnStatus('unknown')
let capturedCallback: any
- vi.spyOn(taskQueue, 'addTask').mockImplementation((deviceId, type, props, cb) => {
+ vi.spyOn(taskQueue, 'addTask').mockImplementation((_deviceId, _type, _props, cb) => {
capturedCallback = cb
return { xml: '', taskId: 'tid-4' }
})
@@ -212,7 +212,7 @@ describe('DeviceActionExecutor — coverage', () => {
it('persistDevice calls DeviceModel.createOrUpdate', async () => {
const device = makeDevice()
let capturedCallback: any
- vi.spyOn(taskQueue, 'addTask').mockImplementation((deviceId, type, props, cb) => {
+ vi.spyOn(taskQueue, 'addTask').mockImplementation((_deviceId, _type, _props, cb) => {
capturedCallback = cb
return { xml: '', taskId: 'tid-p' }
})
@@ -492,7 +492,7 @@ describe('DeviceActionExecutor — callback execution for remaining uncovered li
const device = makeDevice()
device.setGpnStatus('unknown')
let capturedCallback: any
- vi.spyOn(taskQueue, 'addTask').mockImplementation((deviceId, type, props, cb) => {
+ vi.spyOn(taskQueue, 'addTask').mockImplementation((_deviceId, _type, _props, cb) => {
capturedCallback = cb
return { xml: '', taskId: 'tid-nested' }
})
diff --git a/tests/unit/services/cwmp/executing_commands.spec.ts b/tests/unit/services/cwmp/executing_commands.spec.ts
index 3e54da5..4967bc9 100644
--- a/tests/unit/services/cwmp/executing_commands.spec.ts
+++ b/tests/unit/services/cwmp/executing_commands.spec.ts
@@ -15,8 +15,6 @@ vi.mock('../../../../app/models/device.js', () => ({
}))
// Mock CommandModel
-const mockToArray = vi.fn().mockResolvedValue([])
-const mockSort = vi.fn().mockReturnValue({ toArray: mockToArray })
vi.mock('../../../../app/models/command.js', () => ({
default: {
getCollection: vi.fn().mockReturnValue({
@@ -32,10 +30,10 @@ vi.mock('../../../../app/services/parameter_writability.js', () => ({
reclassifyDeviceFromCatalog: vi.fn(),
}))
-import { ExecutingCommandsState, MainStateMachine } from '../../../../app/services/cwmp/main_state_machine.js'
+import { ExecutingCommandsState } from '../../../../app/services/cwmp/main_state_machine.js'
import { Device } from '../../../../app/domain/device/device.js'
import { DeviceId } from '../../../../app/domain/device/device_id.js'
-import { DeviceParameter, DeviceProperty } from '../../../../app/domain/device/device_parameter.js'
+import { DeviceParameter } from '../../../../app/domain/device/device_parameter.js'
import { CWMPTaskQueue } from '../../../../app/services/cwmp/task_queue.js'
import { DeviceActionExecutor } from '../../../../app/services/cwmp/device_action_executor.js'
import { CommandStatus, CommandType } from '../../../../app/domain/commands/command.js'
@@ -196,11 +194,6 @@ describe('ExecutingCommandsState — direct testing', () => {
const cmd = { _id: 'c8', action: 'INVALID_TYPE', parameters: {}, status: CommandStatus.PENDING, mode: ModeType.I, priority: 1 }
setupCommandMock([cmd])
- const device = makeDevice()
- const context = makeContext(device)
- const state = new ExecutingCommandsState(true)
-
- const result = await state.handle(context)
expect(vi.mocked(logger.error)).toHaveBeenCalled()
expect(vi.mocked(CommandModel.updateCommand)).toHaveBeenCalledWith('c8', expect.objectContaining({ status: CommandStatus.FAILED }))
})
@@ -243,8 +236,6 @@ describe('ExecutingCommandsState — direct testing', () => {
// Second handle: receives fault
context.message = { success: false, data: { FaultCode: 9001 } }
- const result = await state.handle(context)
-
expect(vi.mocked(CommandModel.updateCommand)).toHaveBeenCalledWith('c10', expect.objectContaining({ status: CommandStatus.FAILED }))
})
})
diff --git a/tests/unit/services/cwmp/state_machine_manager_extra.spec.ts b/tests/unit/services/cwmp/state_machine_manager_extra.spec.ts
index 411309a..85688ac 100644
--- a/tests/unit/services/cwmp/state_machine_manager_extra.spec.ts
+++ b/tests/unit/services/cwmp/state_machine_manager_extra.spec.ts
@@ -28,7 +28,6 @@ vi.mock('../../../../app/models/command.js', () => ({
import { StateMachineManager, MachineStatus } from '../../../../app/services/cwmp/state_machine_manager.js'
import { Device } from '../../../../app/domain/device/device.js'
import { DeviceId } from '../../../../app/domain/device/device_id.js'
-import { CWMPTaskQueue, ResultStatus } from '../../../../app/services/cwmp/task_queue.js'
function makeDevice(): Device {
const device = new Device(new DeviceId('Sagemcom', 'F8B7FF', 'Livebox 4', 'LB4-TEST-001'))
@@ -118,9 +117,6 @@ describe('StateMachineManager — additional coverage', () => {
// --- continue() serving task from queue ---
it('continue() serves pending task from queue when state machine returns empty', async () => {
- const device = makeDevice()
- const machine = await manager.startStateMachine(device, 'sess-q', { events: ['6 CONNECTION REQUEST'] })
-
// Start the immediate command SM (completes with no commands)
await manager.continue('sess-q')
diff --git a/tests/unit/services/cwmp/task_queue.spec.ts b/tests/unit/services/cwmp/task_queue.spec.ts
index b9053df..d39f828 100644
--- a/tests/unit/services/cwmp/task_queue.spec.ts
+++ b/tests/unit/services/cwmp/task_queue.spec.ts
@@ -1,5 +1,5 @@
import { describe, it, expect, beforeEach, vi } from 'vitest'
-import { CWMPTaskQueue, TaskStatus, ResultStatus, TaskResult } from '../../../../app/services/cwmp/task_queue.js'
+import { CWMPTaskQueue, TaskStatus, ResultStatus } from '../../../../app/services/cwmp/task_queue.js'
import { DeviceId } from '../../../../app/domain/device/device_id.js'
// Mock AdonisJS logger
@@ -101,7 +101,6 @@ describe('CWMPTaskQueue', () => {
return result.status === ResultStatus.Success ? 'ok' : 'fail'
})
// Get the task ID (the first task in the map)
- const task = queue.getTaskForDevice(deviceId)
// Since addTask already dequeued via SENT, we check via callback
// Actually addTask doesn't dequeue — it marks as SENT but keeps in map
// Let's use the registerCallback approach
@@ -117,7 +116,6 @@ describe('CWMPTaskQueue', () => {
it('removes pending tasks but keeps sent ones', () => {
const deviceId = makeDeviceId()
queue.addCWMPTask(deviceId, 'reboot', {})
- const t2 = queue.addCWMPTask(deviceId, 'factory_reset', {})
// Mark first as SENT by getting it
queue.getTaskForDevice(deviceId)
// Now clear — the SENT task should remain, pending ones removed