Skip to content

Commit

Permalink
[test] dbテストの修正 (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
toririm authored Sep 15, 2024
1 parent ece11fa commit cee2c49
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions app/repositories/order.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, expect, test } from "bun:test";
import { beforeAll, describe, expect, test } from "bun:test";

import { connectFirestoreEmulator, getFirestore } from "firebase/firestore";

Expand All @@ -7,19 +7,23 @@ import { type WithId } from "~/lib/typeguard";
import { OrderEntity } from "~/models/order";

import { orderRepoFactory } from "./order";
import { type OrderRepository } from "./type";

describe("[db] orderRepository", async () => {
// To use this environment, firebase emulator must be running.

let savedOrderHoge: WithId<OrderEntity>;
let orderRepository: OrderRepository;

const testDB = getFirestore();
connectFirestoreEmulator(
testDB,
"localhost",
firebasejson.emulators.firestore.port,
);
const orderRepository = orderRepoFactory(testDB);
beforeAll(() => {
const testDB = getFirestore();
connectFirestoreEmulator(
testDB,
"localhost",
firebasejson.emulators.firestore.port,
);
orderRepository = orderRepoFactory(testDB);
});

test("orderRepository is defined", () => {
expect(orderRepository).toBeDefined();
Expand Down

0 comments on commit cee2c49

Please sign in to comment.