Files
genoffice/apps/shell/tests/privacy-doc.test.ts
T
merrick-2002andGenOffice 0a2c25d483 Sync snapshot (2026-08-26) (#159)
- Sheets: CSV export and save support, Excel-matching data validation
- Docs: image, shape, WordArt, and chart rendering fixes
- Slides: downloadable font catalog with a missing-font banner
- Slides: better AI text layout and a speaker-notes tool

Co-authored-by: GenOffice <merrick-2002@users.noreply.github.com>
2026-08-26 17:34:55 +08:00

23 lines
862 B
TypeScript

import { readFileSync } from 'node:fs'
import { join } from 'node:path'
import { describe, expect, it } from 'vitest'
import { INSTALL_FIRST_LAUNCH_EVENT } from '../src/main/analytics'
describe('PRIVACY.md analytics disclosure', () => {
it('lists every event emitted by the shell main process', () => {
const source = readFileSync(join(__dirname, '../src/main/index.ts'), 'utf8')
const privacy = readFileSync(join(__dirname, '../../../PRIVACY.md'), 'utf8')
const emitted = new Set([
...[...source.matchAll(/\banalytics\.track\(\s*['"]([a-z][a-z0-9_]*)['"]/g)].map(
(match) => match[1],
),
INSTALL_FIRST_LAUNCH_EVENT,
])
const documented = new Set(
[...privacy.matchAll(/^- `([a-z][a-z0-9_]*)` —/gm)].map((match) => match[1]),
)
expect([...documented].sort()).toEqual([...emitted].sort())
})
})