const test = require('node:test')
const assert = require('node:assert')
const fs = require('node:fs')
const navs = ['web/src/components/Nav.jsx', 'templates/site/web/src/components/Nav.jsx'].map((f) => fs.readFileSync(f, 'utf8'))
const docs = ['docs/_layouts/default.html', 'templates/site/docs/_layouts/default.html'].map((f) => fs.readFileSync(f, 'utf8'))
test('the paint-scheme chooser rides the menu drawer, not the header', () => {
for (const s of navs) {
assert.ok(s.indexOf('') > s.indexOf('nav-sidebar-title">Appearance'))
}
for (const s of docs) {
const sidebar = s.indexOf(''))
}
})
const htmls = ['web/index.html', 'templates/site/web/index.html'].map((f) => fs.readFileSync(f, 'utf8'))
test('the wordmark is one flex item and the robots meta opts into large previews', () => {
for (const s of navs) {
assert.match(s, //)
}
for (const s of htmls) {
assert.match(s, /max-image-preview:large/)
}
assert.match(fs.readFileSync('DEPLOY.md', 'utf8'), /\| Root directory \| `web` \|/)
})
test('prestruct owns robots.txt and the AEO policy comes from site.config.js', () => {
assert.match(fs.readFileSync('site.config.js', 'utf8'), /robots:\s*\{\s*aeo:\s*\{\s*aiBots:\s*'allow'\s*\}\s*\}/)
assert.match(fs.readFileSync('web/ssr.config.js', 'utf8'), /robots:\s*site\.robots/)
assert.equal(fs.existsSync('web/public/robots.txt'), false, 'the shell must not ship a generated robots.txt')
})