Skip to content

Instantly share code, notes, and snippets.

View thiagoferreiraw's full-sized avatar

Thiago Ferreira thiagoferreiraw

View GitHub Profile
@thiagoferreiraw
thiagoferreiraw / App.test.js
Created November 13, 2018 10:20
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
}
@thiagoferreiraw
thiagoferreiraw / Home.js
Created November 12, 2018 16:14
Home.js
import React from 'react';
import PropTypes from "prop-types"
const Home = ({ username, tasks }) => (
<div>
<p>Welcome, {username}!</p>
<ul>
{tasks && tasks.map((t, idx) => <li key={idx}>{t}</li>)}
</ul>
</div>
@thiagoferreiraw
thiagoferreiraw / App.test.js
Last active November 13, 2018 10:48
React tests - Medium - App.test com enzyme
import React from 'react';
import App from './App';
import { mount } from 'enzyme';
import toJson from "enzyme-to-json"
import Home from './Home';
it("should render the homepage for the non logged in user", () => {
const props = {
isLoggedIn: false,
username: null
@thiagoferreiraw
thiagoferreiraw / App.js
Last active November 9, 2018 12:05
React Tests - Medium
import React, { Component } from 'react';
import PropTypes from "prop-types"
import Home from "./Home"
const fakeDatabase = {
"Heisenberg": [
"8am - Chemistry classes at school",
"12:30pm - Meet Jesse for lunch",
"15pm - Meet Gus at the Pollos Hermanos",
"20pm - Dinner by the pool with Hank and Marie"