Created
July 15, 2015 17:54
-
-
Save Killavus/794b4a3168ba0e3d1882 to your computer and use it in GitHub Desktop.
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/addons'; | |
import { InvitedPerson, InvitationList } from 'components/InvitationList'; | |
describe("Invitation List - testing with shallow rendering", () => { | |
beforeEach(function() { | |
this.examplePeople = [ | |
{ id: 1, name: "Waldo" }, | |
{ id: 2, name: "Hercules" } | |
]; | |
let { TestUtils } = React.addons; | |
this.TestUtils = TestUtils; | |
this.renderer = TestUtils.createRenderer(); | |
this.renderer.render(<InvitationList initiallyInvited={this.examplePeople} />); | |
}); | |
it("renders a list in a box with proper CSS classes and people within it", function() { | |
let result = this.renderer.getRenderOutput(), | |
personOneID = `person_${this.examplePeople[0].id}`, | |
personTwoID = `person_${this.examplePeople[1].id}`; | |
expect(result.type).toEqual('div'); | |
expect(result.props.className).toEqual("invitation-list-container"); | |
expect(result.props.children).toEqual( | |
<ul className="invitation-list" ref='list'> | |
<InvitedPerson key={personOneID} ref={personOneID} person={this.examplePeople[0]} /> | |
<InvitedPerson key={personTwoID} ref={personTwoID} person={this.examplePeople[1]} /> | |
</ul> | |
); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment