Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe("login", () => {
const formConfig = {
baseUrl: "/loyalty",
url: "/log_in",
csrfToken: "csrf",
facebookPath: "/facebook",
twitterPath: "/twitter",
}
afterEach(fetch.mockReset)
it("renders the snapshot", () => {
const login = renderer.create()
expect(login).toMatchSnapshot()
})
it("renders the social buttons with the correct hrefs", () => {
const login = TestUtils.renderIntoDocument() as Login
const aTags = TestUtils.scryRenderedDOMComponentsWithTag(login, "a") as HTMLAnchorElement[]
const facebookLink = aTags.find(tag => tag.href === "/facebook")
expect(facebookLink).toBeTruthy()
const twitterLink = aTags.find(tag => tag.href === "/twitter")
expect(twitterLink).toBeTruthy()
})
it("displays correct error message", done => {
describe("", () => {
const APP_TOKEN = "force-staging"
const SUBMIT_URL = "https://stagingapi.artsy.net/api/v1/users/send_reset_password_instructions"
afterEach(fetch.mockReset)
it("renders the snapshot", () => {
const component = renderer.create()
expect(component).toMatchSnapshot()
})
it("displays correct message on success", done => {
fetch.mockImplementation(() => Promise.resolve({ status: 201 }))
const expectedResult = (
<span>
Instructions on how to reset your password have been sent to <b>test@artsymail.com</b>
</span>
)
const wrapper = shallow()
wrapper.setState({ email: "test@artsymail.com" })