Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history

auth.test.ts

Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.

auth.test.tsBlame40 lines · 2 contributors
06d5ffeClaude1import { describe, it, expect } from "bun:test";
2import {
3 hashPassword,
4 verifyPassword,
5 generateSessionToken,
6 sessionExpiry,
7} from "../lib/auth";
8
9describe("auth utilities", () => {
10 it("should hash and verify passwords", async () => {
76581d3Dictation App11 const password = `test${Math.random().toString(36).slice(2)}`;
06d5ffeClaude12 const hash = await hashPassword(password);
13
14 expect(hash).toBeTruthy();
15 expect(hash).not.toBe(password);
16 expect(await verifyPassword(password, hash)).toBe(true);
17 expect(await verifyPassword("wrongpassword", hash)).toBe(false);
18 });
19
20 it("should generate unique session tokens", () => {
21 const token1 = generateSessionToken();
22 const token2 = generateSessionToken();
23
24 expect(token1).toBeTruthy();
25 expect(token1.length).toBe(64); // 32 bytes hex
26 expect(token1).not.toBe(token2);
27 });
28
29 it("should create future session expiry", () => {
30 const expiry = sessionExpiry();
31 const now = new Date();
32
33 expect(expiry.getTime()).toBeGreaterThan(now.getTime());
34 // Should be ~30 days from now
35 const diffDays =
36 (expiry.getTime() - now.getTime()) / (1000 * 60 * 60 * 24);
37 expect(diffDays).toBeGreaterThan(29);
38 expect(diffDays).toBeLessThan(31);
39 });
76581d3Dictation App40});