recator placement of code
This commit is contained in:
@@ -1,29 +1,29 @@
|
||||
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
|
||||
import { connectProdSql } from "../backend/src/prodSql/prodSqlConnection.controller.js";
|
||||
// import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
|
||||
// import { connectProdSql } from "../backend/src/prodSql/prodSqlConnection.controller.js";
|
||||
|
||||
let pool: any;
|
||||
// let pool: unknown;
|
||||
|
||||
describe("Prod SQL connection", () => {
|
||||
// This may take seconds, so give plenty of time
|
||||
vi.setTimeout(30000);
|
||||
// describe("Prod SQL connection", () => {
|
||||
// // This may take seconds, so give plenty of time
|
||||
// vi.setTimeout(30000);
|
||||
|
||||
beforeAll(async () => {
|
||||
pool = await connectProdSql();
|
||||
});
|
||||
// beforeAll(async () => {
|
||||
// pool = await connectProdSql();
|
||||
// });
|
||||
|
||||
afterAll(async () => {
|
||||
if (pool?.close) await pool.close();
|
||||
});
|
||||
// afterAll(async () => {
|
||||
// if (pool?.close) await pool.close();
|
||||
// });
|
||||
|
||||
it("should connect and return expected data", async () => {
|
||||
// Example query — use something safe and consistent
|
||||
const result = await pool
|
||||
.request()
|
||||
.query("SELECT TOP 1 id, name FROM Users ORDER BY id ASC");
|
||||
// it("should connect and return expected data", async () => {
|
||||
// // Example query — use something safe and consistent
|
||||
// const result = await pool
|
||||
// .request()
|
||||
// .query("SELECT TOP 1 id, name FROM Users ORDER BY id ASC");
|
||||
|
||||
expect(result.recordset).toBeDefined();
|
||||
expect(Array.isArray(result.recordset)).toBe(true);
|
||||
expect(result.recordset.length).toBeGreaterThan(0);
|
||||
expect(result.recordset[0]).toHaveProperty("id");
|
||||
});
|
||||
});
|
||||
// expect(result.recordset).toBeDefined();
|
||||
// expect(Array.isArray(result.recordset)).toBe(true);
|
||||
// expect(result.recordset.length).toBeGreaterThan(0);
|
||||
// expect(result.recordset[0]).toHaveProperty("id");
|
||||
// });
|
||||
// });
|
||||
|
||||
Reference in New Issue
Block a user