fix(ota): reject empty platform payloads
This commit is contained in:
@@ -61,4 +61,30 @@ describe("otaReleaseSchema", () => {
|
||||
}),
|
||||
).toThrow("At least one platform must be provided")
|
||||
})
|
||||
|
||||
it("rejects metadata when platform keys exist without a real payload", () => {
|
||||
const result = otaReleaseSchema.safeParse({
|
||||
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: {
|
||||
ios: undefined,
|
||||
},
|
||||
})
|
||||
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -23,7 +23,7 @@ const platformsSchema = z
|
||||
linux: platformSchema.optional(),
|
||||
})
|
||||
.strict()
|
||||
.refine((platforms) => Object.keys(platforms).length > 0, {
|
||||
.refine((platforms) => Object.values(platforms).some(Boolean), {
|
||||
message: "At least one platform must be provided",
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user