feat : notify new update income

This commit is contained in:
2026-09-26 23:34:42 +07:00 Unverified
parent e99a5b76b1
commit 4ef1968b04
14 changed files with 499 additions and 33 deletions
+14
View File
@@ -6,6 +6,7 @@ import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
vi.mock("server-only", () => ({}));
const { closeRedisEventStreams, createRedisEventResponse } = await import("@/lib/events/redis-stream");
const { getLatestDeploymentStatus, publishDeploymentStatus } = await import("@/lib/deployment/repository");
const { updateVisitorPresence } = await import("@/lib/presence");
const { closeRedisClient, redisEventChannel } = await import("@/lib/redis/client");
const { consumeRateLimit } = await import("@/lib/security/rate-limit");
@@ -102,4 +103,17 @@ describeWithRedis("shared Redis security paths", () => {
second.abort();
await Promise.all([readerA.cancel(), readerB.cancel()]);
});
it("does not let stale deployment results replace a newer announcement", async () => {
const firstId = "a".repeat(40);
const secondId = "b".repeat(40);
expect((await publishDeploymentStatus(firstId, "deploying")).accepted).toBe(true);
expect((await publishDeploymentStatus(secondId, "deploying")).accepted).toBe(true);
expect((await publishDeploymentStatus(firstId, "ready")).accepted).toBe(false);
expect(await getLatestDeploymentStatus()).toMatchObject({
deploymentId: secondId,
status: "deploying",
});
expect((await publishDeploymentStatus(secondId, "failed")).accepted).toBe(true);
});
});