Implemented mechanism to easily retrieve repositories.
This commit is contained in:
parent
0679c16b7d
commit
357a3fce67
4 changed files with 26 additions and 11 deletions
|
@ -1,8 +1,8 @@
|
|||
import {initializeTests} from "../testutils"
|
||||
import {setupTestApp} from "../setup-tests"
|
||||
import {Student} from "../../src/entities/users/student.entity";
|
||||
import {describe, it, expect, beforeAll} from "vitest";
|
||||
import {getRepository} from "../../src/orm";
|
||||
import {StudentRepository} from "../../src/data/users/student-repository";
|
||||
import {getStudentRepository} from "../../src/data/repositories";
|
||||
|
||||
const username = "teststudent";
|
||||
const firstName = "John";
|
||||
|
@ -11,8 +11,8 @@ describe("StudentRepository", () => {
|
|||
let studentRepository: StudentRepository;
|
||||
|
||||
beforeAll(async () => {
|
||||
await initializeTests()
|
||||
studentRepository = getRepository(Student) as StudentRepository;
|
||||
setupTestApp();
|
||||
studentRepository = getStudentRepository();
|
||||
});
|
||||
|
||||
it("should return the queried student after he was added", async () => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {initORM} from "../src/orm";
|
||||
import dotenv from "dotenv";
|
||||
|
||||
export async function initializeTests() {
|
||||
export async function setupTestApp() {
|
||||
dotenv.config({path: ".env.test"});
|
||||
await initORM(true);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue