fix(private-zone): hide incomplete albums and refresh Maya cover
This commit is contained in:
@@ -67,6 +67,20 @@ describe("Private Album schema models", () => {
|
||||
expect(response).not.toHaveProperty("packageOptions");
|
||||
});
|
||||
|
||||
it("keeps incomplete-content metadata without exposing pending images", () => {
|
||||
const response = PrivateAlbumsResponseSchema.parse({
|
||||
items: [],
|
||||
creditBalance: 100,
|
||||
pendingImageCount: 7,
|
||||
hasIncompleteContent: true,
|
||||
pendingImages: [{ url: COVER_URL }],
|
||||
});
|
||||
|
||||
expect(response.pendingImageCount).toBe(7);
|
||||
expect(response.hasIncompleteContent).toBe(true);
|
||||
expect(response).not.toHaveProperty("pendingImages");
|
||||
});
|
||||
|
||||
it("parses an unlock response with all album images", () => {
|
||||
const response = PrivateAlbumUnlockResponseSchema.parse({
|
||||
albumId: ALBUM_ID,
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { arrayOrEmpty, numberOrZero } from "../../nullable-defaults";
|
||||
import {
|
||||
arrayOrEmpty,
|
||||
booleanOrFalse,
|
||||
numberOrZero,
|
||||
} from "../../nullable-defaults";
|
||||
import { PrivateAlbumSchema } from "../private_album";
|
||||
|
||||
export const PrivateAlbumsResponseSchema = z
|
||||
.object({
|
||||
items: arrayOrEmpty(PrivateAlbumSchema),
|
||||
creditBalance: numberOrZero,
|
||||
pendingImageCount: numberOrZero,
|
||||
hasIncompleteContent: booleanOrFalse,
|
||||
})
|
||||
.readonly();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user