-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: covering all pages and components
- Loading branch information
1 parent
b0a2154
commit 0cc796c
Showing
11 changed files
with
469 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,23 @@ | ||
import { NavigationContainer } from "@react-navigation/native"; | ||
import { fireEvent, render, screen } from "@testing-library/react-native"; | ||
|
||
import DataConverterNavigator from "../DataConverterNavigator"; | ||
|
||
describe("DataConverterNavigator", () => { | ||
it("should render correctly", async () => { | ||
expect(true).toBe(true); | ||
render( | ||
<NavigationContainer> | ||
<DataConverterNavigator /> | ||
</NavigationContainer> | ||
); | ||
|
||
const picker = screen.getByTestId("picker"); | ||
|
||
// Simulate changing the value of the Picker | ||
fireEvent(picker, "onValueChange", "AsciiAndHex"); | ||
|
||
// Add your assertions here to check if the navigation and state update occurred | ||
// For example, you can check if the navigation.navigate was called with the correct argument | ||
// and if the selectedLanguage state was updated correctly. }); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,24 @@ | ||
import { render, screen } from "@testing-library/react-native"; | ||
|
||
import Loading from ".."; | ||
import { useTheme } from "../../ThemeContext"; | ||
|
||
jest.mock("../../ThemeContext", () => ({ | ||
useTheme: jest.fn(), | ||
})); | ||
|
||
describe("Loading Component", () => { | ||
it("should render correctly", () => { | ||
(useTheme as jest.Mock).mockReturnValue({ theme: "light" }); | ||
render(<Loading />); | ||
expect(screen.getByTestId("loading-indicator")).toBeTruthy(); | ||
}); | ||
|
||
expect(screen.getByTestId(/loading-indicator/)).toBeTruthy(); | ||
it("should render using dark theme", () => { | ||
(useTheme as jest.Mock).mockReturnValue({ theme: "dark" }); | ||
render(<Loading />); | ||
expect(screen.getByTestId("loading-indicator").props.style).toContainEqual({ | ||
backgroundColor: "black", | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.