Files
inbuxa-admin/well-known-source.test.ts
T
jcoffey-dev 991912ef4f
ci / build (pull_request) Skipped
ci / publish (pull_request) Skipped
ci / notices (pull_request) Successful in 18s
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 58s
Write .well-known/source into the build
The console's public repository and the commit it was built from, in
the form https://coffeylabs.org/specs/well-known-source/ defines. The
commit comes from INBUXA_REVISION, which the image build passes in; a
build without one writes nothing, and nginx answers that address with a
404 rather than the app. tsconfig.node.json drops source-archive.ts,
gone since #7.
2026-10-28 21:57:30 -07:00

26 lines
860 B
TypeScript

// SPDX-FileCopyrightText: 2026 Coffey Labs LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { describe, expect, it } from 'vitest'
import { REPOSITORY, sourceDocument } from './well-known-source'
const COMMIT = '808e6e4c2a1d5e8b7f6a9c0d1e2f3a4b5c6d7e8f'
describe('.well-known/source', () => {
it('names the repository and the commit', () => {
const doc = JSON.parse(sourceDocument('27.1-rc.2', COMMIT)!)
expect(doc).toEqual({
version: 1,
software: [
{ name: 'inbuxa Admin', version: '27.1-rc.2', license: 'AGPL-3.0-only', repository: REPOSITORY, revision: COMMIT },
],
})
})
it('says nothing without a full commit id', () => {
for (const revision of [undefined, '', '808e6e4', 'v27.1-rc.2', COMMIT.replace(/f/g, 'g')]) {
expect(sourceDocument('27.1-rc.2', revision)).toBeUndefined()
}
})
})