-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #779 from Inist-CNRS/improve-redirect-format
try to improve redirect format
- Loading branch information
Showing
2 changed files
with
27 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,23 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
|
||
import InvalidFormat from '../InvalidFormat'; | ||
import RedirectView from './RedirectView'; | ||
|
||
describe('<RedirectView />', () => { | ||
it('should render', () => { | ||
it('should render if url', () => { | ||
const resource = { foo: 'http://example.com' }; | ||
const field = { name: 'foo' }; | ||
const wrapper = shallow( | ||
<RedirectView resource={resource} field={field} />, | ||
); | ||
expect(wrapper.find('a').text()).toEqual('http://example.com'); | ||
}); | ||
it('should render an InvalidFormat for an invalid value', () => { | ||
const resource = { foo: 'Run you fools!' }; | ||
const field = { name: 'foo' }; | ||
const wrapper = shallow( | ||
<RedirectView resource={resource} field={field} />, | ||
); | ||
expect(wrapper.find('span').text()).toEqual('Run you fools!'); | ||
expect(wrapper.find(InvalidFormat).length).toEqual(1); | ||
}); | ||
}); |