MCPcopy Create free account
hub / github.com/ding113/claude-code-hub / createTestKey

Function createTestKey

tests/integration/auth.test.ts:60–84  ·  view source on GitHub ↗
(params: {
  userId: number;
  key: string;
  canLoginWebUi: boolean;
})

Source from the content-addressed store, hash-verified

58}
59
60async function createTestKey(params: {
61 userId: number;
62 key: string;
63 canLoginWebUi: boolean;
64}): Promise<TestKey> {
65 const [row] = await db
66 .insert(keys)
67 .values({
68 userId: params.userId,
69 key: params.key,
70 name: `key-${params.key}`,
71 canLoginWebUi: params.canLoginWebUi,
72 dailyResetMode: "rolling",
73 dailyResetTime: "00:00",
74 })
75 .returning({
76 id: keys.id,
77 userId: keys.userId,
78 key: keys.key,
79 canLoginWebUi: keys.canLoginWebUi,
80 });
81
82 if (!row) throw new Error("创建测试 Key 失败:未返回插入结果");
83 return row;
84}
85
86describe("auth.ts:validateKey / getSession(安全边界)", () => {
87 const createdUserIds: number[] = [];

Callers 1

auth.test.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected