-
Notifications
You must be signed in to change notification settings - Fork 582
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
637bef8
commit f9cc0af
Showing
12 changed files
with
40 additions
and
105 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import { fireEvent } from "@testing-library/react-native" | ||
import { screen } from "@testing-library/react-native" | ||
import { MyAccountEditEmailTestsQuery } from "__generated__/MyAccountEditEmailTestsQuery.graphql" | ||
import { flushPromiseQueue } from "app/utils/tests/flushPromiseQueue" | ||
import { resolveMostRecentRelayOperation } from "app/utils/tests/resolveMostRecentRelayOperation" | ||
import { setupTestWrapper } from "app/utils/tests/setupTestWrapper" | ||
import { graphql } from "react-relay" | ||
import { MyAccountEditEmailContainer, MyAccountEditEmailQueryRenderer } from "./MyAccountEditEmail" | ||
|
@@ -40,71 +39,15 @@ describe(MyAccountEditEmailQueryRenderer, () => { | |
`, | ||
}) | ||
|
||
it("shows confirm email toast when email is changed", async () => { | ||
const { getByText, getByLabelText, env } = renderWithRelay({ | ||
it("show email input", async () => { | ||
renderWithRelay({ | ||
Me: () => ({ | ||
email: "[email protected]", | ||
}), | ||
}) | ||
|
||
await flushPromiseQueue() | ||
|
||
expect(getByText("Email")).toBeTruthy() | ||
|
||
const input = getByLabelText("email-input") | ||
expect(input.props.value).toEqual("[email protected]") | ||
|
||
fireEvent.changeText(input, "[email protected]") | ||
expect(input.props.value).toEqual("[email protected]") | ||
|
||
const saveButton = getByLabelText("save-button") | ||
fireEvent.press(saveButton) | ||
|
||
resolveMostRecentRelayOperation(env, { | ||
Me: () => ({ | ||
email: "[email protected]", | ||
}), | ||
}) | ||
|
||
await flushPromiseQueue() | ||
|
||
expect(mockShow).toHaveBeenCalledWith( | ||
"Please confirm your new email for this update to take effect", | ||
"middle", | ||
{ | ||
duration: "long", | ||
} | ||
) | ||
}) | ||
|
||
it("does not show confirm email toast when email did not change", async () => { | ||
const { getByText, getByLabelText, env } = renderWithRelay({ | ||
Me: () => ({ | ||
email: "[email protected]", | ||
}), | ||
}) | ||
|
||
await flushPromiseQueue() | ||
|
||
expect(getByText("Email")).toBeTruthy() | ||
|
||
const input = getByLabelText("email-input") | ||
expect(input.props.value).toEqual("[email protected]") | ||
|
||
fireEvent.changeText(input, "[email protected]") | ||
expect(input.props.value).toEqual("[email protected]") | ||
|
||
const saveButton = getByLabelText("save-button") | ||
fireEvent.press(saveButton) | ||
|
||
resolveMostRecentRelayOperation(env, { | ||
Me: () => ({ | ||
email: "[email protected]", | ||
}), | ||
}) | ||
|
||
await flushPromiseQueue() | ||
|
||
expect(mockShow).not.toHaveBeenCalled() | ||
expect(screen.getByLabelText("email-input")).toBeTruthy() | ||
}) | ||
}) |
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,12 @@ | ||
import { renderWithWrappersLEGACY } from "app/utils/tests/renderWithWrappers" | ||
import { MyAccountFieldEditScreen } from "./Components/MyAccountFieldEditScreen" | ||
import { screen } from "@testing-library/react-native" | ||
import { renderWithWrappers } from "app/utils/tests/renderWithWrappers" | ||
import { MyAccountEditPassword } from "./MyAccountEditPassword" | ||
|
||
describe(MyAccountEditPassword, () => { | ||
it("has the right title", () => { | ||
const tree = renderWithWrappersLEGACY(<MyAccountEditPassword />) | ||
it("has the right titles", () => { | ||
renderWithWrappers(<MyAccountEditPassword />) | ||
|
||
expect(tree.root.findByType(MyAccountFieldEditScreen).props.title).toEqual("Password") | ||
expect(screen.getByText("Current password")).toBeTruthy() | ||
expect(screen.getByText("New password")).toBeTruthy() | ||
}) | ||
}) |
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