mirror of
https://github.com/stablyai/orca.git
synced 2026-11-02 01:57:57 +00:00
* fix(sidebar): phone feed list leftovers before the flip (dark) Bump the feed's semantics version for P11's desktop facts; mark switch-on phone page bundles so packaging and orcad staging refuse them; show the page's last-listed rows before the first feed read; draw the host's pending creations; pass the listed host's own label into host sections instead of the running device's platform. * fix(sidebar): review fixes for the phone feed leftovers (dark) A dark orcad may stage the dark page (only a marker of an off switch is refused); the bundle tree writer leaves the marker; the pre-feed list keeps the view's filters; a creation names its project only outside that project's header and survives search when its project matches; the feed view and row labels read one resolved desktop platform. * fix(sidebar): second review fixes for the phone feed leftovers (dark) Test the off-switch marker check across switches; resolve the desktop platform once for rows and headers; a section search narrows keeps only matching rows.
71 lines
2.8 KiB
JavaScript
71 lines
2.8 KiB
JavaScript
import { mkdtemp, rm, writeFile } from 'node:fs/promises'
|
|
import { createRequire } from 'node:module'
|
|
import { tmpdir } from 'node:os'
|
|
import { join } from 'node:path'
|
|
import { afterEach, describe, expect, it } from 'vitest'
|
|
|
|
const {
|
|
assertNoDarkOutputOfOffSwitches,
|
|
assertNotDarkBuild,
|
|
darkBuildDefines,
|
|
darkBuildMarkers,
|
|
turnedOnDarkBuildDefines
|
|
} = createRequire(import.meta.url)('../dark-build-switches.cjs')
|
|
|
|
const scratch = []
|
|
afterEach(async () => {
|
|
await Promise.all(scratch.splice(0).map((dir) => rm(dir, { recursive: true, force: true })))
|
|
})
|
|
|
|
describe('dark build switches', () => {
|
|
it.each(['ORCA_LAYOUT_OWNER', 'ORCA_SIDEBAR_INPUTS'])(
|
|
'compiles the dark path in only when %s=main asks',
|
|
(variable) => {
|
|
expect(darkBuildDefines({ [variable]: 'main' })[variable]).toBe('"main"')
|
|
expect(darkBuildDefines({ [variable]: 'window' })[variable]).toBe('"window"')
|
|
expect(darkBuildDefines({})[variable]).toBe('"window"')
|
|
expect(turnedOnDarkBuildDefines({ [variable]: 'main' })).toEqual({ [variable]: '"main"' })
|
|
expect(turnedOnDarkBuildDefines({})).toEqual({})
|
|
}
|
|
)
|
|
|
|
it('keeps the layout-owner marker name packaging already refuses', () => {
|
|
expect(darkBuildMarkers({ ORCA_LAYOUT_OWNER: 'main' })).toEqual([
|
|
{
|
|
fileName: 'ORCA_LAYOUT_OWNER_MAIN',
|
|
text: 'Built with ORCA_LAYOUT_OWNER=main, for dark testing only.\n'
|
|
}
|
|
])
|
|
expect(darkBuildMarkers({})).toEqual([])
|
|
})
|
|
|
|
it.each(['ORCA_LAYOUT_OWNER', 'ORCA_SIDEBAR_INPUTS'])(
|
|
'refuses %s at packaging time, and any output its dark build marked',
|
|
async (variable) => {
|
|
const clean = await mkdtemp(join(tmpdir(), 'orca-dark-build-clean-'))
|
|
const dark = await mkdtemp(join(tmpdir(), 'orca-dark-build-dark-'))
|
|
scratch.push(clean, dark)
|
|
const [marker] = darkBuildMarkers({ [variable]: 'main' })
|
|
await writeFile(join(dark, marker.fileName), marker.text)
|
|
|
|
expect(() => assertNotDarkBuild([clean], {})).not.toThrow()
|
|
expect(() => assertNotDarkBuild([clean], { [variable]: 'main' })).toThrow(`${variable}=main`)
|
|
expect(() => assertNotDarkBuild([clean, dark], {})).toThrow(dark)
|
|
}
|
|
)
|
|
|
|
it.each([
|
|
['ORCA_LAYOUT_OWNER', 'ORCA_SIDEBAR_INPUTS'],
|
|
['ORCA_SIDEBAR_INPUTS', 'ORCA_LAYOUT_OWNER']
|
|
])('lets a dark build carry its own %s output, never one of %s', async (own, other) => {
|
|
const dark = await mkdtemp(join(tmpdir(), 'orca-dark-build-own-'))
|
|
scratch.push(dark)
|
|
const [marker] = darkBuildMarkers({ [own]: 'main' })
|
|
await writeFile(join(dark, marker.fileName), marker.text)
|
|
|
|
expect(() => assertNoDarkOutputOfOffSwitches([dark], { [own]: 'main' })).not.toThrow()
|
|
expect(() => assertNoDarkOutputOfOffSwitches([dark], { [other]: 'main' })).toThrow(dark)
|
|
expect(() => assertNoDarkOutputOfOffSwitches([dark], {})).toThrow(dark)
|
|
})
|
|
})
|