Created
March 8, 2016 23:36
-
-
Save busypeoples/e749bd06b3ba8ed78a80 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 createShallowRelaseTable = (noOutOfPrint = false, searchText = '') => { | |
let items = [{ artist: 'foobar', title: 'bar', outOfPrint: true }]; | |
let props = { searchText, releases: items, noOutOfPrint }; | |
return shallow(<ReleaseTable { ...props } />); | |
} | |
describe('<ReleaseTable>', () => { | |
it('contains the class name releaseTable', () => { | |
let release = createShallowRelaseTable(); | |
expect(release.is('.releaseTable')).toBeTruthy(); | |
}); | |
it('renders release item', () => { | |
let release = createShallowRelaseTable(); | |
expect(release.find(Release).length).toBe(1); | |
}); | |
it('filters out any out of print items', () => { | |
let release = createShallowRelaseTable(true, ''); | |
expect(release.find(Release).length).toBe(0); | |
}); | |
it('filters out any out of items when filtering by search text', () => { | |
let release = createShallowRelaseTable(false, 'bla'); | |
expect(release.find(Release).length).toBe(0); | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment