Skip to content

test: Add missing error path tests for TCP transport #260

Description

@groupsky

Description

TCP transport unit tests have excellent coverage (94.05% statements), but several error paths are not tested.

Missing Unit Tests

1. Write Operations Without Handler

Lines not covered: tcp.ts:174, 214, 250

  • setRegister without request handler
  • setRegisterArray without request handler
  • setCoil without request handler
  • getDiscreteInput without request handler

2. Coil and Discrete Input Integration Tests

Missing from emulator.tcp.integration.test.ts:

  • Read coils (getCoil)
  • Write single coil (setCoil)
  • Read discrete inputs (getDiscreteInput)

Expected Coverage Increase

Current: 94.05% statements, 81.57% branches
Target: 95%+ statements, 85%+ branches

Adding 7 tests should cover the missing error paths and bring coverage above 95%.

Acceptance Criteria

  • Add 4 unit tests for write operations without handler
  • Add 3 integration tests for coil/discrete input operations
  • All tests pass
  • Coverage increases to 95%+ statements
  • Coverage increases to 85%+ branches

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions