Skip to content

152 — Protocol code is unique per protocol

Description

Each protocol gets a unique generated code. Creating two COMPLETED_WORK_LIST protocols on the same received order yields two distinct codes, both matching the SPP prefix + year + counter format.

Preconditions

  • Clean database (TestControl.cleanDb())
  • User logged in with ADMIN and ACCOUNTING roles
  • Customer, contract and received order created via API

Steps

  1. Create a COMPLETED_WORK_LIST protocol (item price 1000) — Expected: detail page, code generated
  2. Create a second COMPLETED_WORK_LIST protocol on the same order (item price 2000) — Expected: detail page, code generated
  3. Return to /protocolsExpected: exactly two rows
  4. Read both code cells — Expected: both match ^SPP\d{8}$ and are distinct
  • Spec: tests/e2e/tests/protocols.spec.ts
  • DB enforces a unique constraint on Protocol.code