import { expect, test } from 'bun:test'
import { mkdtemp, rm } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join, resolve } from 'node:path'
import { processDirectives } from '@stacksjs/stx/process'
import { defaultConfig } from '@stacksjs/stx/config'
import { click, findChrome, launch, navigate, settle } from '@stacksjs/testing/browser'
const componentsDir = resolve(import.meta.dir, '../../storage/framework/defaults/resources/components/Storefront')
test('basket summaries distinguish an item subtotal from a quoted final total without changing default labels', async () => {
const root = await mkdtemp(join(tmpdir(), 'stacks-order-summary-'))
try {
const options = { ...defaultConfig, root, componentsDir, cache: false }
const custom = await processDirectives('', {}, join(root, 'Custom.stx'), options, new Set())
expect(custom).toContain('Your basket')
expect(custom).toContain('Items total')
expect(custom).toContain('>Tax')
const standard = await processDirectives('', {}, join(root, 'Standard.stx'), options, new Set())
expect(standard).toContain('Order summary')
expect(standard).toContain('>Total
')
expect(standard).not.toContain('>Tax')
}
finally { await rm(root, { recursive: true, force: true }) }
})
test('product cards render generic descriptions and transparent pricing without image overlays', async () => {
const root = await mkdtemp(join(tmpdir(), 'stacks-product-card-'))
try {
const html = await processDirectives('', {}, join(root, 'Page.stx'), { ...defaultConfig, root, componentsDir, cache: false }, new Set())
expect(html).toContain('href="/shop?size=M"')
expect(html).toContain('Repairable mobility')
const visible = html.replace(/