fix(ota): require at least one platform
This commit is contained in:
parent
dc3d0c50e2
commit
a0916f7695
|
|
@ -37,4 +37,28 @@ describe("otaReleaseSchema", () => {
|
|||
expect(parsed.runtimeVersion).toBe("0.4.1")
|
||||
expect(Object.keys(parsed.platforms)).toEqual(["ios"])
|
||||
})
|
||||
|
||||
it("rejects metadata with no platforms", () => {
|
||||
expect(() =>
|
||||
otaReleaseSchema.parse({
|
||||
schemaVersion: 1,
|
||||
product: "mobile",
|
||||
channel: "production",
|
||||
releaseVersion: "0.4.2",
|
||||
releaseKind: "ota",
|
||||
runtimeVersion: "0.4.1",
|
||||
publishedAt: "2026-04-10T12:00:00Z",
|
||||
git: {
|
||||
tag: "mobile/v0.4.2",
|
||||
commit: "abcdef1234567890",
|
||||
},
|
||||
policy: {
|
||||
storeRequired: false,
|
||||
minSupportedBinaryVersion: "0.4.1",
|
||||
message: null,
|
||||
},
|
||||
platforms: {},
|
||||
}),
|
||||
).toThrow("At least one platform must be provided")
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ const platformsSchema = z
|
|||
linux: platformSchema.optional(),
|
||||
})
|
||||
.strict()
|
||||
.refine((platforms) => Object.keys(platforms).length > 0, {
|
||||
message: "At least one platform must be provided",
|
||||
})
|
||||
|
||||
export const otaReleaseSchema = z.object({
|
||||
schemaVersion: z.literal(1),
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
"r2_buckets": [
|
||||
{
|
||||
"binding": "OTA_BUCKET",
|
||||
"bucket_name": "REPLACE_WITH_DEV_BUCKET_NAME",
|
||||
"bucket_name": "replace-with-dev-bucket-name",
|
||||
},
|
||||
],
|
||||
"vars": {
|
||||
|
|
|
|||
Loading…
Reference in New Issue