---
id: ATS-COM-CAT-018
scope: CAP-COM-CAT-018
product_area: commerce
module: catalog
revision: 2
status: proposed
source_sha:
  services-commerce: c8b66a98e2490617aec38ba5c8165dd9bd0a8f9b
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
scenarios:
  - id: ATS-COM-CAT-018-01
    title: Sample preview matches checkout calculations
    level: api
    proves:
      - BR-CAP-COM-CAT-018-01
      - AS-JNY-COM-CAT-004-06
    preconditions: Member and Student carts use combining and noncombining codes
    steps: Compare sample and checkout preview results for each fixture
    expected: 'Line amounts, totals and explanations agree in the exercised cases'
    negative: false
    data_needs: Promotions and prices
    bound_to:
      - TST-COM-CAT-093
    provenance: test
    source: >-
      services-commerce:modules/promotions/tests/e2e/promotion-previews.e2e.spec.js#is, line for
      line and total for total, what the real checkout preview answers
    category: interaction
    binding_evidence:
      - >-
        services-commerce:modules/promotions/tests/e2e/promotion-previews.e2e.spec.js#is, line for
        line and total for total, what the real checkout preview answers
      - >-
        services-commerce:modules/promotions/tests/e2e/promotion-previews.e2e.spec.js#is what the
        real checkout preview answers, explanations included
    step_evidence:
      - do: Compare sample and checkout preview results for each fixture
        provenance: test
        source: >-
          services-commerce:modules/promotions/tests/e2e/promotion-previews.e2e.spec.js#is, line for
          line and total for total, what the real checkout preview answers
    assertions:
      - expect: 'Line amounts, totals and explanations agree in the exercised cases'
        provenance: test
        source: >-
          services-commerce:modules/promotions/tests/e2e/promotion-previews.e2e.spec.js#is, line for
          line and total for total, what the real checkout preview answers
  - id: ATS-COM-CAT-018-02
    title: Parts assessment and shipping omission need dedicated proof
    level: api
    proves:
      - BR-CAP-COM-CAT-018-02
    preconditions: Part and shipping offers are configured
    steps: 'Preview parts, an included automatic draft and a shipping offer'
    expected: Part criteria reach assessment and no benefit uses an absent rated shipping charge
    negative: false
    data_needs: Merchandise area provider
    bound_to: []
    provenance: proposed
    source: >-
      services-commerce:modules/promotions/services/previews/promotion-previews.ts:includingPromotions
    category: rule
    step_evidence:
      - do: 'Preview parts, an included automatic draft and a shipping offer'
        provenance: proposed
        source: >-
          services-commerce:modules/promotions/services/previews/promotion-previews.ts:includingPromotions
    assertions:
      - expect: Part criteria reach assessment and no benefit uses an absent rated shipping charge
        provenance: proposed
        source: >-
          services-commerce:modules/promotions/services/previews/promotion-previews.ts:includingPromotions
  - id: ATS-COM-CAT-018-03
    title: Preview preserves persisted commerce state
    level: api
    proves:
      - BR-CAP-COM-CAT-018-03
    preconditions: The workspace already has checkouts
    steps: Preview several sample carts and compare stored counts and usage
    expected: No relevant row or usage count changes
    negative: false
    data_needs: none
    bound_to:
      - TST-COM-CAT-093
      - TST-COM-CAT-116
    provenance: test
    source: >-
      services-commerce:modules/promotions/tests/e2e/promotion-previews.e2e.spec.js#opens no
      checkout and writes no item, event, evaluation, redemption, reservation or order
    category: invariant
    binding_evidence:
      - >-
        services-commerce:modules/promotions/tests/e2e/promotion-previews.e2e.spec.js#opens no
        checkout and writes no item, event, evaluation, redemption, reservation or order
      - >-
        services-commerce:modules/promotions/tests/e2e/promotion-previews.e2e.spec.js#consumes no
        use of any promotion
      - >-
        services-commerce:modules/promotions/tests/integration/services/previews/promotion-previews.integration.spec.js#writes
        no checkout, item, event, evaluation, redemption or reservation
    step_evidence:
      - do: Preview several sample carts and compare stored counts and usage
        provenance: test
        source: >-
          services-commerce:modules/promotions/tests/e2e/promotion-previews.e2e.spec.js#opens no
          checkout and writes no item, event, evaluation, redemption, reservation or order
    assertions:
      - expect: No relevant row or usage count changes
        provenance: test
        source: >-
          services-commerce:modules/promotions/tests/e2e/promotion-previews.e2e.spec.js#opens no
          checkout and writes no item, event, evaluation, redemption, reservation or order
  - id: ATS-COM-CAT-018-04
    title: Including a draft changes only the assessment
    level: api
    proves:
      - BR-CAP-COM-CAT-018-04
    preconditions: A draft automatic promotion is available
    steps: Preview with and without explicitly including it
    expected: Totals change from eighty to seventy-two dollars while the record remains draft
    negative: false
    data_needs: none
    bound_to:
      - TST-COM-CAT-116
    provenance: test
    source: >-
      services-commerce:modules/promotions/tests/integration/services/previews/promotion-previews.integration.spec.js#judges
      a draft as if active only when it is named: $80.00 without, $72.00 with
    category: edge
    binding_evidence:
      - >-
        services-commerce:modules/promotions/tests/integration/services/previews/promotion-previews.integration.spec.js#judges
        a draft as if active only when it is named: $80.00 without, $72.00 with
      - >-
        services-commerce:modules/promotions/tests/integration/services/previews/promotion-previews.integration.spec.js#leaves
        the draft a draft and its uses at none
    step_evidence:
      - do: Preview with and without explicitly including it
        provenance: test
        source: >-
          services-commerce:modules/promotions/tests/integration/services/previews/promotion-previews.integration.spec.js#judges
          a draft as if active only when it is named: $80.00 without, $72.00 with
    assertions:
      - expect: Totals change from eighty to seventy-two dollars while the record remains draft
        provenance: test
        source: >-
          services-commerce:modules/promotions/tests/integration/services/previews/promotion-previews.integration.spec.js#judges
          a draft as if active only when it is named: $80.00 without, $72.00 with
  - id: ATS-COM-CAT-018-05
    title: Preview requires console read access
    level: api
    proves:
      - BR-CAP-COM-CAT-018-06
    preconditions: 'Fixtures include a promotion reader, an ungranted caller and a portal buyer'
    steps: Submit previews and invalid request bodies
    expected: Only the authorized console caller succeeds and malformed inputs fail
    negative: true
    data_needs: Personas
    bound_to:
      - TST-COM-CAT-093
    provenance: test
    source: >-
      services-commerce:modules/promotions/tests/e2e/promotion-previews.e2e.spec.js#serves a console
      caller who holds only the promotions read key
    category: permission
    binding_evidence:
      - >-
        services-commerce:modules/promotions/tests/e2e/promotion-previews.e2e.spec.js#serves a
        console caller who holds only the promotions read key
      - >-
        services-commerce:modules/promotions/tests/e2e/promotion-previews.e2e.spec.js#refuses a
        console caller without the promotions read key, 403
      - >-
        services-commerce:modules/promotions/tests/e2e/promotion-previews.e2e.spec.js#refuses a
        portal member, 403
      - >-
        services-commerce:modules/promotions/tests/e2e/promotion-previews.e2e.spec.js#refuses a body
        with no items, 400
    step_evidence:
      - do: Submit previews and invalid request bodies
        provenance: test
        source: >-
          services-commerce:modules/promotions/tests/e2e/promotion-previews.e2e.spec.js#serves a
          console caller who holds only the promotions read key
    assertions:
      - expect: Only the authorized console caller succeeds and malformed inputs fail
        provenance: test
        source: >-
          services-commerce:modules/promotions/tests/e2e/promotion-previews.e2e.spec.js#serves a
          console caller who holds only the promotions read key
evidence:
  - 'Pinned service inputs: test sources in scenario bindings'
  - 'Pinned console inputs: console sources in scenario bindings'
  - >-
    rhythm-v2-docs:specs/commerce/catalog/planning/capabilities/CAP-COM-CAT-018-try-promotions-on-a-sample-cart-before-they-go-live.md#CAP-COM-CAT-018
  - >-
    rhythm-v2-docs:specs/commerce/catalog/design/workflows/WF-COM-CAT-016-try-promotions-on-a-sample-cart.md#WF-COM-CAT-016
product_intent: proposed
coverage:
  rule: covered
  transition: not-applicable
  validation: 'gap: FND-COM-CAT-072'
  permission: covered
  edge: covered
  failure: 'gap: FND-COM-CAT-072'
  boundary: 'gap: FND-COM-CAT-072'
  concurrency: 'gap: FND-COM-CAT-072'
  invariant: covered
  interaction: covered
coverage_notes:
  validation: >-
    No complete validation scenario is established by this back-fill; the finding records the
    missing proof.
  failure: >-
    No complete failure scenario is established by this back-fill; the finding records the missing
    proof.
  boundary: >-
    No complete boundary scenario is established by this back-fill; the finding records the missing
    proof.
  concurrency: Concurrent execution has no complete scenario; sequential retry is insufficient proof.
  transition: >-
    Sample preview has no persisted lifecycle or transition; explicitly including a draft assesses
    it without moving its state.
permission_coverage:
  - key: commerce.promotions.read
    coverage: 'gap: FND-COM-CAT-072'
    reason: >-
      Existing permission examples cover selected personas, not the independent allow and deny
      matrix for every named key.
    provenance: unknown
    source:
      - 'rhythm-v2-docs:specs/commerce/catalog/FINDINGS.md#FND-COM-CAT-072'
---

# Preview a promotion against a sample cart: Capability Test Specification

## Coverage

| Rule | Proof Scenario or Gap |
|---|---|
| `BR-CAP-COM-CAT-018-01` | `ATS-COM-CAT-018-01` |
| `BR-CAP-COM-CAT-018-02` | `ATS-COM-CAT-018-02` |
| `BR-CAP-COM-CAT-018-03` | `ATS-COM-CAT-018-03` |
| `BR-CAP-COM-CAT-018-04` | `ATS-COM-CAT-018-04` |
| `BR-CAP-COM-CAT-018-06` | `ATS-COM-CAT-018-05` |

## Interactions With Related Capabilities

Sample preview matches checkout calculations.

Coverage describes specified proof. A binding names the existing assertions that contribute to it; proposed designs remain unexecuted.
