moneyPath.contract.test.mjs
699 Bytes
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
const pageUrl = new URL('../createOrder.js', import.meta.url)
describe('createOrder money-path contract', () => {
it('IT-WO-MONEY-001: page orchestration does not reintroduce raw money coercion or rounding', async () => {
const source = await readFile(pageUrl, 'utf8')
const forbidden = [
/Number\(activitySellPrice\)/,
/Number\(activitySnapshotPrice\)/,
/Number\(fallback\)/,
/Math\.ceil\(finalPrice \* 100\)/,
/parseFloat\(str\)/
]
forbidden.forEach(pattern => {
assert.doesNotMatch(source, pattern)
})
})
})