openpencil/tools/release-packages/tests/release-notes.test.ts
Danila Poyarkov c4a3dae2a4
ci: unify verified release builds (#711)
* ci: fix desktop build cache ownership

* build: centralize native release artifact validation

Reuse package command execution and npm artifact paths. Share release identity and target metadata, consume explicit Tauri artifact outputs, and reject incomplete or mixed-run artifact sets before draft publication.

* refactor: use release package aliases across directories

* ci: coordinate verified native and npm releases

Build shared frontend inputs once and keep native targets parallel. Bind their complete artifact set to immutable source and workflow revisions, verify updater signatures and attestations, and replace draft assets only after preflight and verified npm publication.

* test: group native release tests by domain
2026-09-16 21:58:38 +03:00

64 lines
1.4 KiB
TypeScript

import { describe, expect, test } from 'bun:test'
import { mkdir, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { readReleaseNotes } from '#release/release-notes'
const changelog = `# Changelog
## Unreleased
### Added
- Pending work.
## 1.2.0 — 2026-08-16
### Added
- Shipped **feature**.
### Fixed
- Corrected behavior.
## 1.1.0 — 2026-08-01
### Fixed
- Previous fix.
`
async function changelogPath(contents = changelog) {
const directory = join(tmpdir(), `open-pencil-release-notes-${crypto.randomUUID()}`)
await mkdir(directory, { recursive: true })
const path = join(directory, 'CHANGELOG.md')
await writeFile(path, contents)
return path
}
describe('readReleaseNotes', () => {
test('extracts the requested version without its heading and preserves Markdown', async () => {
expect(await readReleaseNotes(await changelogPath(), '1.2.0')).toBe(
`### Added
- Shipped **feature**.
### Fixed
- Corrected behavior.
`
)
})
test('rejects missing and empty release sections', async () => {
await expect(readReleaseNotes(await changelogPath(), '9.9.9')).rejects.toThrow(
'Changelog section not found for 9.9.9'
)
await expect(
readReleaseNotes(await changelogPath('## 1.2.0 — 2026-08-16\n'), '1.2.0')
).rejects.toThrow('Changelog section is empty for 1.2.0')
})
})