|
| 1 | +import { init_tables, init_views, teardown } from "@db/init_tables"; |
| 2 | +import { test_knexDb } from "@test/test_knexfile"; |
| 3 | +import app from "@v1/match/router"; |
1 | 4 | import type { MatchReport } from "@v1/match/schemas"; |
2 | 5 | import { mock_MatchReport } from "@v1/match/test/mock.schemas"; |
3 | | -import app from "@v1/match/router"; |
4 | 6 | import { Hono } from "hono"; |
5 | 7 | import { testClient } from "hono/testing"; |
6 | | -import { describe, expect, test } from "vitest"; |
| 8 | +import { afterEach, beforeEach, describe, expect, test } from "vitest"; |
| 9 | + |
7 | 10 |
|
| 11 | +// TODO: Unsure how to write tests here. |
| 12 | +// If e2e tests should not be a superset of tested functionality on integration tests, can we prevent total overlapping? |
| 13 | +// How can we inject test_knexDb to the `service.ts` functions while only calling HTTP routes? |
8 | 14 | describe("A user may report a Match", () => { |
| 15 | + beforeEach(async () => { |
| 16 | + await init_tables(test_knexDb); |
| 17 | + await init_views(test_knexDb); |
| 18 | + }); |
| 19 | + afterEach(async () => { |
| 20 | + await teardown(test_knexDb); |
| 21 | + }); |
9 | 22 | test("POST a mock MatchReport", async () => { |
10 | 23 | const query: MatchReport = mock_MatchReport(); |
11 | | - const response = await app.request("/") |
| 24 | + const response = await app.request("/"); |
12 | 25 | }); |
13 | 26 | }); |
0 commit comments