-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sarah Allen
committed
Apr 3, 2019
1 parent
f0b57a6
commit df069c9
Showing
6 changed files
with
62 additions
and
74 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { shallow } from 'enzyme' | ||
import React from 'react' | ||
import { observable } from 'mobx' | ||
import { Media } from '@zooniverse/react-components' | ||
import FieldGuideItemIcon from './FieldGuideItemIcon' | ||
import { FieldGuideMediumFactory } from '../../../../../../../../../test/factories' | ||
|
||
const medium = FieldGuideMediumFactory.build() | ||
const attachedMedia = observable.map() | ||
attachedMedia.set(medium.id, medium) | ||
|
||
describe('Component > FieldGuideItemIcon', function () { | ||
const icon = attachedMedia.get(medium.id) | ||
it('should render without crashing', function () { | ||
const wrapper = shallow( | ||
<FieldGuideItemIcon | ||
icon={icon} | ||
/>) | ||
expect(wrapper).to.be.ok | ||
}) | ||
|
||
it('should render a Media component if there is an icon', function () { | ||
const wrapper = shallow( | ||
<FieldGuideItemIcon | ||
icon={icon} | ||
/>) | ||
expect(wrapper.find(Media)).to.have.lengthOf(1) | ||
}) | ||
|
||
it('should render a placeholder svg if there is not an icon', function () { | ||
const wrapper = shallow(<FieldGuideItemIcon />) | ||
expect(wrapper.find(Media)).to.have.lengthOf(0) | ||
expect(wrapper.find('svg')).to.have.lengthOf(1) | ||
}) | ||
}) |
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
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
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