Something went wrong. Try again.
Browser extension: detect and subscribe to standard.site publications on ATProto
Something went wrong. Try again.
1.3 kB · 36 lines
JavaScript
12345678910111213141516171819202122232425262728293031323334353637import { readFileSync } from 'node:fs'import { join } from 'node:path'import { describe, expect, it } from 'vitest'
import { pngSize } from './render-icons.mjs'
const brand = join(import.meta.dirname, '..', 'brand')
describe('sticker variants embed the mark verbatim', () => { // Both stickers claim to hold mark.svg's elements unchanged, only wrapped // in a scale/translate. If someone tweaks a rect or the squiggle in one // place but not the others, the logo forks. const markLines = readFileSync(join(brand, 'mark.svg'), 'utf8') .split('\n') .map((l) => l.trim()) .filter((l) => l.startsWith('<rect') || l.startsWith('<path') || l.startsWith('d='))
it.each(['sticker.svg', 'sticker-round.svg'])('%s', (file) => { const svg = readFileSync(join(brand, file), 'utf8') expect(markLines.length).toBeGreaterThan(0) for (const line of markLines) { expect(svg).toContain(line) } })})
describe('pngSize', () => { it('reads IHDR dimensions', () => { const png = readFileSync(join(brand, 'icon480-round.png')) expect(pngSize(png)).toEqual({ width: 480, height: 480 }) })
it('rejects non-PNG bytes', () => { expect(() => pngSize(new Uint8Array([1, 2, 3]))).toThrow('not a PNG') })})