File size: 1,035 Bytes
e079a73 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import {describe, expect, it} from "bun:test"
import {packagedBuildInfo} from "../packagedBuildInfo"
const embedded = {appVersion: "3.2.1", buildCommit: "old", buildBranch: "old", buildUser: "old", buildTime: "old"}
describe("build identity for reused Android/iOS apps", () => {
it("shows the current PR without changing the embedded application version", () => {
const info = {commit: "a".repeat(40), branch: "current", user: "tester", time: "now"}
expect(packagedBuildInfo({mentraPrBuild: {schemaVersion: 1, buildInfo: info}}, embedded)).toEqual({
appVersion: "3.2.1",
buildCommit: info.commit,
buildBranch: "current",
buildUser: "tester",
buildTime: "now",
})
})
it("preserves local/release identity and rejects partial packaged metadata", () => {
expect(packagedBuildInfo(undefined, embedded)).toEqual(embedded)
expect(packagedBuildInfo({mentraPrBuild: {schemaVersion: 1, buildInfo: {commit: "bad"}}}, embedded)).toEqual(
embedded,
)
})
})
|