createOrderActionsTemplate.test.mjs
804 Bytes
import { readFileSync } from 'node:fs'
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
const template = readFileSync(
new URL('../createOrder.wxml', import.meta.url),
'utf8'
)
const actionsStart = template.indexOf('<view class="btns-con">')
const actionsEnd = template.indexOf('\n\t</view>', actionsStart)
const actions = template.slice(actionsStart, actionsEnd)
describe('createOrder bottom actions', () => {
it('only exposes direct order submission without the archive action', () => {
assert.ok(actionsStart >= 0)
assert.ok(actionsEnd > actionsStart)
assert.match(actions, /class="confirm text-center" bindtap="submit">直接下单<\/view>/)
assert.doesNotMatch(actions, /data-save/)
assert.doesNotMatch(actions, />建档<\/view>/)
})
})