Repositorio de codigos de activacion + test

This commit is contained in:
2026-03-10 12:38:55 +01:00
parent 5e76c4f48c
commit 07d49aab29
5 changed files with 134 additions and 1134 deletions

View File

@@ -4,6 +4,7 @@ import { httpclient } from "config/httpclient.config.js";
import { pgClient } from "config/pgclient.config.js";
import { NfcRepository } from "./Nfc.repository.js";
import type { ServerContext } from "domain/ServerContext.js";
import { uuidv7 } from "uuidv7";
describe("NfcRepository Integration Tests", () => {
const serverContext: ServerContext = {
@@ -12,7 +13,7 @@ describe("NfcRepository Integration Tests", () => {
};
const repo = new NfcRepository(serverContext);
const testCardId = "test-card-" + Date.now();
const testCardId = uuidv7()
const testCode = "12345678";
// Clean up before and after tests to ensure isolation
@@ -61,12 +62,14 @@ describe("NfcRepository Integration Tests", () => {
});
test("findActivationCodes should return empty array if card has no codes", async () => {
const result = await repo.findActivationCodes("non-existent-card");
const nonExistentCard = uuidv7()
const result = await repo.findActivationCodes(nonExistentCard);
if (result.error) {
assert.fail(`findActivationCodes failed: ${result.error}`);
}
assert.ok(result.data, "Data should be returned");
assert.strictEqual(result.data.length, 0);
});