Skip to content

Instantly share code, notes, and snippets.

@thiagoferreiraw
Created November 13, 2018 10:20
Show Gist options
  • Save thiagoferreiraw/0cd25bc76b5b47e12de3a0dcf4a20bfd to your computer and use it in GitHub Desktop.
Save thiagoferreiraw/0cd25bc76b5b47e12de3a0dcf4a20bfd to your computer and use it in GitHub Desktop.
App.test.js - Com snapshot
import React from 'react';
import App from './App';
import { mount } from 'enzyme';
import toJson from "enzyme-to-json"
it("should render the homepage for the non logged in user", () => {
const props = {
isLoggedIn: false,
username: null
}
const app = mount(<App {...props} />)
expect(toJson(app)).toMatchSnapshot()
})
it("should render the Homepage for the logged in user (Heisenberg)", () => {
const props = {
isLoggedIn: true,
username: "Heisenberg"
}
const app = mount(<App {...props} />)
expect(toJson(app)).toMatchSnapshot()
})
it("should render the Homepage for the logged in user without tasks", () => {
const props = {
isLoggedIn: true,
username: "Jesse"
}
const app = mount(<App {...props} />)
expect(toJson(app)).toMatchSnapshot()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment