Files

19 lines
947 B
JavaScript

import assert from 'node:assert/strict'
import fs from 'node:fs'
import path from 'node:path'
import test from 'node:test'
import { fileURLToPath } from 'node:url'
const here = path.dirname(fileURLToPath(import.meta.url))
const source = fs.readFileSync(path.join(here, 'pricing.mjs'), 'utf8')
test('price-book acceptance is portable and reuses a deployed active source by default', () => {
assert.match(source, /process\.env\.ADMIN_TEST_PRICE_BOOK_FILE/)
assert.match(source, /activeBefore\[0\]/)
assert.match(source, /requestBinary\('GET', `\$\{PRICE_BOOK_PATH\}\/\$\{encodeURIComponent\(activeFixture\.id\)\}\/source`\)/)
assert.match(source, /复用当前生效价格源作为本轮隔离上传夹具/)
assert.match(source, /sourceName = 'active-price-book-fixture\.xlsx'/)
assert.doesNotMatch(source, /sourceName = activeFixture\.originalFileName/)
assert.doesNotMatch(source, /WXWork|Users\\BY-OY|DEFAULT_PRICE_BOOK_FILE/)
})