mirror of
https://github.com/Chewbaccalakis/rfid-database.git
synced 2026-09-10 00:11:56 -07:00
Implement RFID tag dump PWA with REST API, auth, and CI
Add Next.js app with SQLite/Drizzle storage for sites and LF/HF tag dumps, multi-user Auth.js (credentials + optional OIDC), personal API tokens in Settings, versioned /api/v1 for UI and future CLI use, MCT/Proxmark/JSON import-export, PWA offline shell, Vitest tests, and GitHub Actions CI.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { formatUid, normalizeUid, tryNormalizeUid } from "@/lib/rfid/uid";
|
||||
|
||||
describe("normalizeUid", () => {
|
||||
it("strips separators and uppercases", () => {
|
||||
expect(normalizeUid("04:a1:b2:c3")).toBe("04A1B2C3");
|
||||
expect(normalizeUid("04 a1 b2 c3")).toBe("04A1B2C3");
|
||||
expect(normalizeUid("04a1b2c3")).toBe("04A1B2C3");
|
||||
});
|
||||
|
||||
it("rejects odd length", () => {
|
||||
expect(() => normalizeUid("04A")).toThrow();
|
||||
});
|
||||
|
||||
it("formats with colons", () => {
|
||||
expect(formatUid("04a1b2c3")).toBe("04:A1:B2:C3");
|
||||
});
|
||||
|
||||
it("tryNormalizeUid returns null on bad input", () => {
|
||||
expect(tryNormalizeUid("xyz")).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user