feat : notify new update income
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user