Test orders
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { test, describe } from "vitest"
|
||||
import { jwtService } from "../config/jwtService.config.js"
|
||||
|
||||
describe("Tokens Objenious", () => {
|
||||
/*
|
||||
describe("Tokens Objenious", (test) => {
|
||||
const jwt = jwtService
|
||||
|
||||
test("Solicicitud normal de auth", async () => {
|
||||
@@ -14,4 +14,4 @@ describe("Tokens Objenious", () => {
|
||||
console.log("acceso refresh objenious", token)
|
||||
})
|
||||
})
|
||||
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,6 @@ import { OrderRepository } from "./OrderRepository.js";
|
||||
import { CreateOrderDTO, OrderQuery } from "../domain/Order.js";
|
||||
import { postgresClient } from "../config/config.test.js";
|
||||
import assert from "node:assert";
|
||||
import { Query } from "pg";
|
||||
|
||||
const order1 = <CreateOrderDTO>{
|
||||
correlation_id: "fakeRMQid-1234",
|
||||
@@ -30,11 +29,6 @@ describe("Test OrderRepository", {}, (ctx) => {
|
||||
const result1 = await orderRepo.createOrder(order1)
|
||||
assert.ok(result1.data != undefined, result1.error as string)
|
||||
testIds.push(result1.data.id)
|
||||
|
||||
// Order2 -> Para el test de crearOrder
|
||||
// const result2 = await orderRepo.createOrder(order2)
|
||||
// assert(result2.data != undefined)
|
||||
// testIds.push(result2.data.id)
|
||||
})
|
||||
|
||||
it("Insert new Order", async () => {
|
||||
@@ -75,7 +69,6 @@ describe("Test OrderRepository", {}, (ctx) => {
|
||||
it("Get pending orders should return all pending orders in ASC order", async () => {
|
||||
// We already have 'testId' from before block
|
||||
|
||||
|
||||
// Insert two more orders
|
||||
const orderA = { ...order1, correlation_id: "pending-A" }
|
||||
const orderB = { ...order1, correlation_id: "pending-B" }
|
||||
@@ -174,12 +167,17 @@ describe("Test OrderRepository", {}, (ctx) => {
|
||||
it("Query generates with parameters", async () => {
|
||||
const params: OrderQuery = {
|
||||
conditions: {
|
||||
status: "-eq 'pending'"
|
||||
status: "-eq 'pending'",
|
||||
retry_count: "-gte 2",
|
||||
webhook_host: "-eq NULL"
|
||||
|
||||
}
|
||||
}
|
||||
//@ts-expect-error
|
||||
const res = orderRepo.generateTableQuery("test", params)
|
||||
console.log("Query:", res)
|
||||
assert.ok(res != undefined)
|
||||
assert.ok(res != undefined, "Query must be defined")
|
||||
assert.ok(res.values.length == 3, "Query parameters must be the same as conditions")
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user