-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40fa603
commit 57eb6c2
Showing
16 changed files
with
312 additions
and
139 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { mockImplicitAccount } from "@umami/core"; | ||
import { addTestAccount, makeStore } from "@umami/state"; | ||
|
||
import { App } from "./App"; | ||
import { render, screen } from "../testUtils"; | ||
|
||
jest.mock("@chakra-ui/react", () => ({ | ||
...jest.requireActual("@chakra-ui/react"), | ||
useBreakpointValue: jest.fn(map => map["lg"]), | ||
})); | ||
|
||
describe("<App />", () => { | ||
it("renders welcome screen for a new user", () => { | ||
render(<App />); | ||
|
||
expect(screen.getByTestId("welcome-view")).toBeVisible(); | ||
expect(screen.queryByTestId("signed-in-layout")).not.toBeInTheDocument(); | ||
}); | ||
|
||
it("renders signed-in layout for an existing user", () => { | ||
const store = makeStore(); | ||
addTestAccount(store, mockImplicitAccount(0)); | ||
|
||
render(<App />, { store }); | ||
|
||
expect(screen.getByTestId("signed-in-layout")).toBeVisible(); | ||
expect(screen.queryByTestId("welcome-view")).not.toBeInTheDocument(); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { useCurrentAccount } from "@umami/state"; | ||
|
||
import { BeaconProvider } from "../components/beacon"; | ||
import { Layout } from "../Layout"; | ||
import { Welcome } from "../views/Welcome"; | ||
|
||
export const App = () => { | ||
const currentAccount = useCurrentAccount(); | ||
|
||
return currentAccount ? ( | ||
<BeaconProvider> | ||
<Layout /> | ||
</BeaconProvider> | ||
) : ( | ||
<Welcome /> | ||
); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./App"; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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.