How to use the isomorphic-fetch.default.mockReset function in isomorphic-fetch

To help you get started, we’ve selected a few isomorphic-fetch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github artsy / reaction / src / Apps / Loyalty / Containers / Login / __tests__ / index.tsx View on Github external
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 => {
github artsy / reaction / src / Apps / Loyalty / Containers / ForgotPassword / __tests__ / index.tsx View on Github external
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" })