fix(app): editor route split into dialogs and pickers components, canvas without lint suppression, findings picker coverage restored; golden test pins every generated draft file; stale doc lines
This commit is contained in:
1 parent
0476276a8f
commit
09d8b01a54
11 files changed
+374
-161
No files matched your search
@@ -1,7 +1,6 @@
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import { readdir, readFile } from 'node:fs/promises'
|
||||
import { join } from 'node:path'
|
||||
import {
|
||||
DRAFT_SEED_SQL_FILE,
|
||||
EQUINE_DRAFT_DIR,
|
||||
EQUINE_LEGACY_IMPORT_DIR,
|
||||
EQUINE_SOURCE_PATHS,
|
||||
@@ -19,6 +18,14 @@ let legacy: Record<string, string>
|
||||
let draftFiles: Record<string, string>
|
||||
let draft: DraftResult
|
||||
|
||||
/** Recursive file list, relative to `dir`, with forward slashes. */
|
||||
async function listFiles(dir: string): Promise<string[]> {
|
||||
const entries = await readdir(dir, { recursive: true, withFileTypes: true })
|
||||
return entries
|
||||
.filter((entry) => entry.isFile())
|
||||
.map((entry) => join(entry.parentPath, entry.name).slice(dir.length + 1))
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
const run = await runDraft()
|
||||
draft = run.draft
|
||||
@@ -56,14 +63,18 @@ describe('committed legacy-import folder (golden)', () => {
|
||||
})
|
||||
|
||||
describe('committed draft folder (golden)', () => {
|
||||
it.each([
|
||||
'document.json',
|
||||
'assets.json',
|
||||
'CHANGELOG.md',
|
||||
'REVIEW-REPORT.md',
|
||||
DRAFT_SEED_SQL_FILE,
|
||||
])('%s equals a fresh run (rerun pnpm import:equine)', async (file) => {
|
||||
expect(await readFile(join(draftDir, file), 'utf8')).toBe(draftFiles[file])
|
||||
it('equals a fresh run for every produced file (rerun pnpm import:equine)', async () => {
|
||||
for (const [file, content] of Object.entries(draftFiles)) {
|
||||
expect(await readFile(join(draftDir, file), 'utf8'), file).toBe(content)
|
||||
}
|
||||
})
|
||||
|
||||
it('holds no file the run does not produce', async () => {
|
||||
const expected = [
|
||||
...Object.keys(draftFiles),
|
||||
...draft.assets.map((asset) => `assets/${asset.file}`),
|
||||
]
|
||||
expect((await listFiles(draftDir)).sort()).toEqual(expected.sort())
|
||||
})
|
||||
|
||||
it('holds the cleaned drawing with the recorded sha256', async () => {
|
||||
|
||||
Reference in new issue
Block a user