2026-04-15 12:47:26 +02:00
|
|
|
import { before, describe, it } from "node:test";
|
2026-04-07 13:20:31 +02:00
|
|
|
import { ObjeniousOperationsRepository } from "./ObjeniousOperationRepository.js";
|
|
|
|
|
import { httpObjClient, postgresClient } from "../config/config.test.js";
|
2026-04-15 12:47:26 +02:00
|
|
|
import { ObjeniousOperation } from "../domain/operationsRepository.port.js";
|
|
|
|
|
|
|
|
|
|
const correctOperation: ObjeniousOperation = {
|
|
|
|
|
iccids: "test",
|
|
|
|
|
operation: "activate",
|
|
|
|
|
status: "finished"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const errorOperation: ObjeniousOperation = {
|
|
|
|
|
iccids: "test",
|
|
|
|
|
operation: "terminate",
|
|
|
|
|
status: "error",
|
|
|
|
|
error: "mensaje de error"
|
|
|
|
|
}
|
2026-04-07 13:20:31 +02:00
|
|
|
|
|
|
|
|
describe("[Integration] Test API requests", () => {
|
|
|
|
|
const repository = new ObjeniousOperationsRepository(
|
|
|
|
|
httpObjClient,
|
|
|
|
|
postgresClient
|
|
|
|
|
)
|
|
|
|
|
|
2026-04-15 12:47:26 +02:00
|
|
|
before(async () => {
|
|
|
|
|
await repository.createOperation(correctOperation)
|
|
|
|
|
await repository.createOperation(errorOperation)
|
|
|
|
|
})
|
2026-04-07 13:20:31 +02:00
|
|
|
|
2026-04-15 12:47:26 +02:00
|
|
|
it("Read last operation by line", () => {
|
|
|
|
|
/**
|
|
|
|
|
* Objetivo:
|
|
|
|
|
* - Cuando se va a hacer una operacion de sim hay que cancelarla directamente si:
|
|
|
|
|
* - Ya hay una en curso del mismo tipo.
|
|
|
|
|
* - Ya ha terminado una del mismo tipo.
|
2026-04-15 13:50:20 +02:00
|
|
|
* - Se ignoran las erroneas
|
2026-04-15 12:47:26 +02:00
|
|
|
*/
|
2026-04-07 13:20:31 +02:00
|
|
|
})
|
|
|
|
|
})
|