Repositorio de codigos de activacion + test
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user