Created
March 8, 2016 23:34
-
-
Save busypeoples/26595bb9713c1844fcb1 to your computer and use it in GitHub Desktop.
This file contains 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' | |
import { shallow, mount, render } from 'enzyme' | |
import Root, { SearchBar, ReleaseTable, Release } from '../src/Root' | |
const createShallowRelease = (outOfPrint = true) => { | |
let props = {release: { artist: 'foobar', title: 'bar', outOfPrint }}; | |
return shallow(<Release {...props} />); | |
}; | |
describe('<Release>', () => { | |
it('contains the class name release', () => { | |
let release = createShallowRelease(); | |
expect(release.is('.release')).toBeTruthy(); | |
}); | |
it ('contains the class name outOfPrint if out of print', () => { | |
let release = createShallowRelease(true); | |
expect(release.is('.outOfPrint')).toBeTruthy(); | |
}); | |
it ('does not contain the class name outOfPrint if available', () => { | |
let release = createShallowRelease(false); | |
expect(release.is('.outOfPrint')).toBeFalsy(); | |
}); | |
it ('renders the artist name', () => { | |
let release = createShallowRelease(); | |
expect(release.find('.artist').text()).toEqual('foobar'); | |
}); | |
it ('renders the release title', () => { | |
let release = createShallowRelease(); | |
expect(release.find('.title').text()).toEqual('bar'); | |
}); | |
it ('renders the correct comment', () => { | |
let release = createShallowRelease(true); | |
expect(release.find('.comment').text()).toEqual('Out Of Print!'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment