fix: 完善刷新令牌与联合限流
This commit is contained in:
@@ -61,6 +61,38 @@ describe("database authority constraints", () => {
|
||||
});
|
||||
afterAll(async () => prisma.$disconnect());
|
||||
|
||||
it("defines indexed refresh-token history", async () => {
|
||||
const columns = await prisma.$queryRaw<Array<{ column_name: string }>>`
|
||||
SELECT column_name FROM information_schema.columns
|
||||
WHERE table_schema = 'public' AND table_name = 'refresh_tokens'`;
|
||||
expect(columns.map(({ column_name }) => column_name)).toEqual(
|
||||
expect.arrayContaining([
|
||||
"token_hash",
|
||||
"session_id",
|
||||
"generation",
|
||||
"status",
|
||||
"used_at",
|
||||
"replaced_by_hash",
|
||||
"created_at",
|
||||
"expires_at",
|
||||
]),
|
||||
);
|
||||
const indexes = await prisma.$queryRaw<Array<{ indexdef: string }>>`
|
||||
SELECT indexdef FROM pg_indexes WHERE schemaname = 'public' AND tablename = 'refresh_tokens'`;
|
||||
expect(
|
||||
indexes.some(
|
||||
({ indexdef }) =>
|
||||
indexdef.includes("UNIQUE") && indexdef.includes("token_hash"),
|
||||
),
|
||||
).toBe(true);
|
||||
expect(
|
||||
indexes.some(
|
||||
({ indexdef }) =>
|
||||
indexdef.includes("session_id") && indexdef.includes("generation"),
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("expresses independent moderation and pool lifecycle state", async () => {
|
||||
const author = await createAccount("states");
|
||||
const bottle = await prisma.bottle.create({
|
||||
|
||||
Reference in New Issue
Block a user