import test from 'brittle'
// ⚠ SKIPPED — `mergeManifest` and the whole `pgh bootstrap publish` overlay-manifest flow were REMOVED
// on purpose in 3120d1a ("#66 bootstrap: tar local app trees on install; drop `pgh bootstrap` command"):
// the bootstrap app IS the app, so the curl-installable artifacts are now just a tar of the local app
// tree, built by reconcileBootstrapArtifacts (covered by test/bootstrap-artifacts.test.js). This test file
// was left behind importing the deleted module.
//
// That import threw at MODULE LOAD, and because `npm test` globs test/*.test.js it aborted the ENTIRE pgh
// suite before any test ran — so no change to this repo could be verified against it, from 3120d1a until
// now. The import is gone and the cases are skipped rather than deleted: they still document the merge
// semantics if that conveyance ever comes back.
// const { mergeManifest } = await import('../lib/commands/bootstrap.js')
test.skip('mergeManifest seeds install.sh blob + adds an overlay entry', (t) => {
const m = mergeManifest(null, { name: 'pgh-bootstrap-bare-linux-x64.tar.gz', kind: 'overlay', contentHash: 'aa', size: 10 })
t.is(m.version, 1)
const names = m.files.map(f => f.name)
t.ok(names.includes('install.sh'), 'install.sh blob present')
t.is(m.files.find(f => f.name === 'install.sh').kind, 'blob', 'install.sh is a blob')
const o = m.files.find(f => f.name.startsWith('pgh-bootstrap'))
t.is(o.kind, 'overlay'); t.is(o.contentHash, 'aa'); t.is(o.size, 10)
})
test.skip('mergeManifest accumulates multiple apps + replaces on re-publish', (t) => {
let m = mergeManifest(null, { name: 'pgh-bootstrap-bare-linux-x64.tar.gz', kind: 'overlay', contentHash: 'aa', size: 10 })
m = mergeManifest(m, { name: 'pgh-sidecar-bootstrap-bare-linux-x64.tar.gz', kind: 'overlay', contentHash: 'bb', size: 20 })
t.is(m.files.length, 3, 'install.sh + pgh + pgh-sidecar')
// re-publish pgh with a new hash → replaces, doesn't duplicate
m = mergeManifest(m, { name: 'pgh-bootstrap-bare-linux-x64.tar.gz', kind: 'overlay', contentHash: 'cc', size: 11 })
t.is(m.files.length, 3, 'no duplicate on re-publish')
t.is(m.files.find(f => f.name === 'pgh-bootstrap-bare-linux-x64.tar.gz').contentHash, 'cc', 'hash updated')
t.is(m.files.find(f => f.name === 'pgh-sidecar-bootstrap-bare-linux-x64.tar.gz').contentHash, 'bb', 'sidecar untouched')
})
test.skip('mergeManifest preserves an existing install.sh entry + is idempotent without an entry', (t) => {
const seed = { version: 1, files: [{ name: 'install.sh', kind: 'blob' }] }
const m = mergeManifest(seed, null)
t.is(m.files.length, 1)
t.is(m.files[0].name, 'install.sh')
})