work on downloading some more.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
jest.mock("@/app/i18n/api", () => require("../../__mocks__/api.ts"));
|
||||
import { renderRouter} from 'expo-router/testing-library';
|
||||
import { renderRouter } from "expo-router/testing-library";
|
||||
import React from "react";
|
||||
import {
|
||||
act,
|
||||
@ -13,14 +13,21 @@ import {
|
||||
createNavigationContainerRef,
|
||||
} from "@react-navigation/native";
|
||||
import TTNavStack from "../TTNavStack";
|
||||
import { migrateDb } from "@/app/lib/db";
|
||||
|
||||
describe("Navigation", () => {
|
||||
beforeEach(() => {
|
||||
beforeEach(async () => {
|
||||
await migrateDb("development", "up");
|
||||
// Reset the navigation state before each test
|
||||
jest.clearAllMocks();
|
||||
jest.useFakeTimers();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await migrateDb("development", "down");
|
||||
jest.clearAllMocks();
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
it("Navigates to ConversationThread on language selection", async () => {
|
||||
const MockComponent = jest.fn(() => <TTNavStack />);
|
||||
renderRouter(
|
||||
@ -28,7 +35,7 @@ describe("Navigation", () => {
|
||||
index: MockComponent,
|
||||
},
|
||||
{
|
||||
initialUrl: '/',
|
||||
initialUrl: "/",
|
||||
}
|
||||
);
|
||||
const languageSelectionText = await waitFor(() =>
|
||||
@ -47,14 +54,16 @@ describe("Navigation", () => {
|
||||
index: MockComponent,
|
||||
},
|
||||
{
|
||||
initialUrl: '/',
|
||||
initialUrl: "/",
|
||||
}
|
||||
);
|
||||
const settingsButton = await waitFor(() =>
|
||||
screen.getByText(/.*Settings.*/i)
|
||||
);
|
||||
fireEvent.press(settingsButton);
|
||||
expect(await waitFor(() => screen.getByText(/Settings/i))).toBeOnTheScreen();
|
||||
expect(
|
||||
await waitFor(() => screen.getByText(/Settings/i))
|
||||
).toBeOnTheScreen();
|
||||
// expect(waitFor(() => screen.getByText(/Settings/i))).toBeTruthy()
|
||||
expect(screen.getByText("Settings")).toBeOnTheScreen();
|
||||
});
|
||||
|
Reference in New Issue
Block a user