Created
November 20, 2020 20:55
-
-
Save TCotton/86546abd3f391e7b023cad5603ff6ed0 to your computer and use it in GitHub Desktop.
chapter one - react test
This file contains hidden or 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
import React from 'react'; | |
export const Appointment = ({customer: { firstName }}) => <div>{firstName}</div>; | |
import React from 'react'; | |
import ReactDOM from 'react-dom' | |
import { Appointment } from '../src/Appointment'; | |
let container; | |
let component; | |
const render = component => ReactDOM.render(component, container); | |
describe("Appointment", () => { | |
beforeEach(() => { | |
container = document.createElement('div');; | |
}); | |
it('renders the custom first name', () => { | |
const customer = { firstName: 'Ashley'}; | |
component = <Appointment customer={customer} /> | |
render(component, container); | |
expect(container.textContent).toMatch('Ashley'); | |
}) | |
it('renders another customer first name', () => { | |
const customer = { firstName: 'Jordon'}; | |
component = <Appointment customer={customer} /> | |
render(component, container); | |
expect(container.textContent).toMatch('Jordon'); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment