Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
import assert from 'node:assert/strict'
import { access, readFile } from 'node:fs/promises'
import test from 'node:test'
const pages = [
'index.html',
'flash/index.html',
'preference/index.html',
'mod-gallery/index.html',
'mediapipe/index.html',
'simulator/index.html',
'editor/index.html',
'editor/tutorial.html',
'face-editor/index.html',
]
await access(new URL('./assets/stackchan-icon.png', import.meta.url))
await access(new URL('./assets/stackchan-symbol.png', import.meta.url))
await access(new URL('./assets/stackchan-favicon-32.png', import.meta.url))
await access(new URL('./assets/stackchan-apple-touch-icon.png', import.meta.url))
test('all Vite entry pages reference the shared browser icons', async () => {
for (const page of pages) {
const pageUrl = new URL(`./${page}`, import.meta.url)
const html = await readFile(pageUrl, 'utf8')
const linkHref = (rel) => {
const linkTag = html.match(new RegExp(`<link\\b[^>]*\\brel="${rel}"[^>]*>`))?.[0]
return linkTag?.match(/\bhref="([^"]+)"/)?.[1]
}
const favicon = linkHref('icon')
const appleIcon = linkHref('apple-touch-icon')
assert.ok(favicon, `${page} should reference a favicon`)
assert.ok(appleIcon, `${page} should reference an apple-touch-icon`)
assert.equal(
new URL(favicon, pageUrl).pathname,
new URL('./assets/stackchan-favicon-32.png', import.meta.url).pathname
)
assert.equal(
new URL(appleIcon, pageUrl).pathname,
new URL('./assets/stackchan-apple-touch-icon.png', import.meta.url).pathname
)
}
})
e14740673This file is pinned to the selected release. Download the original to open it in your design tool.