A test file under packages/client now says which face it covers:
`*.client.spec.{ts,tsx}` and its `*.client.{ts,tsx}` helpers belong to the
Client aggregate, `*.host.spec.ts` to the host aggregate. The carrier's four
node-half specs take the Host suffix.
The two suffixes are mutually exclusive, so each aggregate excludes the
other's and both keep one broad test glob: `exclude` wins over `include`, and
`packages/client/**` no longer has to be excluded wholesale from the host
program with per-file `files` entries carved back out of it. A Host-face spec
that reaches only Host source therefore needs no cross-face project
reference, which the split-project rule rejects.
vitest still discovers every file through `**/*.spec.{ts,tsx}`.
34 lines
1.6 KiB
TypeScript
34 lines
1.6 KiB
TypeScript
/** Web-localized copy for the four shipped presets and file copy for every other row. */
|
|
|
|
import { describe, expect, it } from 'vitest'
|
|
import { en, presetDisplayText, zh } from '../src/client/locales.ts'
|
|
|
|
const translate = (bundle: typeof en) => (key: keyof typeof en): string => bundle[key]
|
|
|
|
describe('preset display copy', () => {
|
|
it.each([
|
|
['standard', 'presetStandardName', 'presetStandardDescription'],
|
|
['code', 'presetCodeName', 'presetCodeDescription'],
|
|
['minimal', 'presetMinimalName', 'presetMinimalDescription'],
|
|
['cordis', 'presetCordisName', 'presetCordisDescription'],
|
|
] as const)('localizes the shipped %s preset in English and Chinese', (id, nameKey, descriptionKey) => {
|
|
const preset = { id, trust: 'system' as const, name: 'file name', description: 'file description' }
|
|
|
|
expect(presetDisplayText(preset, translate(en)))
|
|
.toEqual({ name: en[nameKey], description: en[descriptionKey] })
|
|
expect(presetDisplayText(preset, translate(zh)))
|
|
.toEqual({ name: zh[nameKey], description: zh[descriptionKey] })
|
|
})
|
|
|
|
it('keeps file metadata for user and unknown system presets', () => {
|
|
const fileCopy = { name: '我的标准', description: '团队自己的 preset。' }
|
|
|
|
expect(presetDisplayText({ id: 'standard', trust: 'user', ...fileCopy }, translate(en)))
|
|
.toEqual(fileCopy)
|
|
expect(presetDisplayText({ id: 'deployment-extra', trust: 'system', ...fileCopy }, translate(en)))
|
|
.toEqual(fileCopy)
|
|
expect(presetDisplayText({ id: 'bare', trust: 'user' }, translate(en)))
|
|
.toEqual({ name: 'bare' })
|
|
})
|
|
})
|