import test, { describe } from "node:test"; import { CreateObjeniousLineDTO } from "sim-shared/domain/objeniousLine.js"; import { ObjeniousLinesRepository } from "./ObjeniousLinesRepository.js"; import { postgrClient } from "../config/postgreConfig.js"; import assert from "node:assert"; describe("Line insertion test", async () => { //const pgClient = postgreClientIntranet const pgClient = postgrClient // En prod hay que usar el de Intrantet para usar la otra base de datos const lineRepository = new ObjeniousLinesRepository(pgClient) const lineaTest: CreateObjeniousLineDTO = { simId: "1234", iccid: "9999999999999", msisdn: "34654674732", imei: "219789481293", imeiChangeDate: new Date(), offerCode: "SAVEFAMILY1", status: "ACTIVATED", preactivationDate: new Date(), activationDate: new Date(), commercialStatus: "test", commercialStatusDate: new Date(), billingStatus: "test", billingStatusChangeDate: new Date(), billingActivationDate: new Date(), createDate: new Date(), raw: { test: "test" } as any // Para este test no hace falta } test("Should insert new line", async () => { const res = await lineRepository.insertOrUpdate(lineaTest) assert.ok(res != undefined, "The line wasn't created") }) test("Should not update a line if the hash is the same", async () => { const res = await lineRepository.insertOrUpdate(lineaTest) console.log("Update", res) assert.ok(res != undefined, "The line wasn't updated") }) })