refactor(frontend): Start test-app voor individuele testfiles
This commit is contained in:
parent
196875538d
commit
e59dead5a9
2 changed files with 23 additions and 7 deletions
|
@ -1,8 +1,19 @@
|
||||||
import { StudentController } from "../../src/controllers/students";
|
import { StudentController } from "../../src/controllers/students";
|
||||||
import { expect, it } from "vitest";
|
import { expect, it, describe, afterAll, beforeAll } from 'vitest';
|
||||||
|
import { setup, teardown } from '../setup-backend.js';
|
||||||
|
|
||||||
it("Get students", async () => {
|
describe('Test controller students', () => {
|
||||||
const controller = new StudentController();
|
beforeAll(async () => {
|
||||||
const data = await controller.getAll(true);
|
await setup();
|
||||||
expect(data.students).to.have.length.greaterThan(0);
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await teardown();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Get students", async () => {
|
||||||
|
const controller = new StudentController();
|
||||||
|
const data = await controller.getAll(true);
|
||||||
|
expect(data.students).to.have.length.greaterThan(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,8 +9,13 @@ export default mergeConfig(
|
||||||
environment: "jsdom",
|
environment: "jsdom",
|
||||||
exclude: [...configDefaults.exclude, "e2e/**"],
|
exclude: [...configDefaults.exclude, "e2e/**"],
|
||||||
root: fileURLToPath(new URL("./", import.meta.url)),
|
root: fileURLToPath(new URL("./", import.meta.url)),
|
||||||
// Startup the backend server, because it is needed for some tests
|
|
||||||
globalSetup: ["./tests/setup-backend.ts"],
|
/*
|
||||||
|
* The test-backend server can be started for each test-file individually using `beforeAll(() => setup())`,
|
||||||
|
* or for all tests once using:
|
||||||
|
globalSetup: ["./tests/setup-backend.ts"],
|
||||||
|
* In this project, the backend server is started for each test-file individually.
|
||||||
|
*/
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue