minPriceApprovalActivityPrice.test.mjs 807 Bytes
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'

const { resolveApprovalActivityPrice } = await import(
  '../tabWorkOrder/pages/createOrder/services/minPriceApproval.js'
)

describe('resolveApprovalActivityPrice', () => {
  it('uses activitySellPrice when present', () => {
    assert.equal(
      resolveApprovalActivityPrice({
        marketingFlag: 1,
        activityId: 7,
        activitySellPrice: 30,
        sellPrice: 0
      }),
      30
    )
  })

  it('does not fall back to modified sellPrice for marketing goods', () => {
    assert.equal(
      resolveApprovalActivityPrice({
        marketingFlag: 1,
        activityId: 7,
        sellPrice: '0',
        price: 99,
        catalogSellPrice: 99,
        upgradePrice: 99
      }),
      99
    )
  })
})