generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
3c1adb2
commit 6a8bd4d
Showing
6 changed files
with
256 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import DatasetEsri from './DatasetEsri'; | ||
|
||
jest.mock('@eeacms/search', () => ({ | ||
runRequest: jest.fn(), | ||
})); | ||
|
||
const dataset = { | ||
'ESRI:REST': [ | ||
{ | ||
id: 1, | ||
url: 'https://example.org/1', | ||
protocol: 'https', | ||
name: 'First', | ||
description: 'Something here', | ||
}, | ||
], | ||
}; | ||
|
||
describe('DatasetEsri', () => { | ||
it('renders correctly', () => { | ||
const tree = renderer.create(<DatasetEsri dataset={dataset} />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
38 changes: 38 additions & 0 deletions
38
src/components/ItemView/Datasets/DatasetHttpLinks.test.jsx
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,38 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import DatasetHttpLinks from './DatasetHttpLinks'; | ||
|
||
jest.mock('@eeacms/search', () => ({ | ||
runRequest: jest.fn(), | ||
})); | ||
|
||
const dataset = { | ||
'WWW:LINK-1.0-http--link': [ | ||
{ | ||
id: 1, | ||
url: 'https://example.org/1', | ||
protocol: 'https', | ||
name: 'First', | ||
description: 'Something here', | ||
}, | ||
], | ||
DOI: [ | ||
{ | ||
id: 1, | ||
url: 'https://example.org/1', | ||
protocol: 'https', | ||
name: 'First', | ||
description: 'Something here', | ||
}, | ||
], | ||
}; | ||
|
||
describe('DatasetHttpLinks', () => { | ||
it('renders correctly', () => { | ||
const tree = renderer | ||
.create(<DatasetHttpLinks dataset={dataset} />) | ||
.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
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,27 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import DatasetLinks from './DatasetLinks'; | ||
|
||
jest.mock('@eeacms/search', () => ({ | ||
runRequest: jest.fn(), | ||
})); | ||
|
||
const dataset = { | ||
'WWW:LINK': [ | ||
{ | ||
id: 1, | ||
url: 'https://example.org/1', | ||
protocol: 'https', | ||
name: 'First', | ||
description: 'Something here', | ||
}, | ||
], | ||
}; | ||
|
||
describe('DatasetEsri', () => { | ||
it('renders correctly', () => { | ||
const tree = renderer.create(<DatasetLinks dataset={dataset} />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
51 changes: 51 additions & 0 deletions
51
src/components/ItemView/Datasets/__snapshots__/DatasetEsri.test.jsx.snap
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,51 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`DatasetEsri renders correctly 1`] = ` | ||
Array [ | ||
<h5> | ||
Services: | ||
</h5>, | ||
<div | ||
className="ui divided relaxed list" | ||
role="list" | ||
> | ||
<div | ||
className="item" | ||
onClick={[Function]} | ||
role="listitem" | ||
> | ||
<div | ||
className="content" | ||
> | ||
<div> | ||
<svg | ||
className="icon" | ||
dangerouslySetInnerHTML={ | ||
Object { | ||
"__html": undefined, | ||
} | ||
} | ||
style={ | ||
Object { | ||
"fill": "currentColor", | ||
"height": "20px", | ||
"width": "auto", | ||
} | ||
} | ||
/> | ||
<a | ||
className="item-link" | ||
href="https://example.org/1" | ||
rel="noreferrer" | ||
target="_blank" | ||
> | ||
https | ||
First | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div>, | ||
] | ||
`; |
82 changes: 82 additions & 0 deletions
82
src/components/ItemView/Datasets/__snapshots__/DatasetHttpLinks.test.jsx.snap
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,82 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`DatasetHttpLinks renders correctly 1`] = ` | ||
Array [ | ||
<h5> | ||
Links: | ||
</h5>, | ||
<div | ||
className="ui divided relaxed list" | ||
role="list" | ||
> | ||
<div | ||
className="item" | ||
onClick={[Function]} | ||
role="listitem" | ||
> | ||
<div | ||
className="content" | ||
> | ||
<div | ||
className="dataset-item" | ||
> | ||
<i | ||
aria-hidden="true" | ||
className="icon linkify" | ||
onClick={[Function]} | ||
/> | ||
<a | ||
className="item-link" | ||
href="https://example.org/1" | ||
rel="noreferrer" | ||
target="_blank" | ||
> | ||
<span> | ||
First | ||
</span> | ||
</a> | ||
</div> | ||
</div> | ||
<span | ||
className="item-description" | ||
> | ||
Something here | ||
</span> | ||
</div> | ||
<div | ||
className="item" | ||
onClick={[Function]} | ||
role="listitem" | ||
> | ||
<div | ||
className="content" | ||
> | ||
<div | ||
className="dataset-item" | ||
> | ||
<i | ||
aria-hidden="true" | ||
className="icon info circle" | ||
onClick={[Function]} | ||
/> | ||
<a | ||
className="item-link" | ||
href="https://example.org/1" | ||
rel="noreferrer" | ||
target="_blank" | ||
> | ||
<span> | ||
First | ||
</span> | ||
</a> | ||
</div> | ||
</div> | ||
<span | ||
className="item-description" | ||
> | ||
Something here | ||
</span> | ||
</div> | ||
</div>, | ||
] | ||
`; |
31 changes: 31 additions & 0 deletions
31
src/components/ItemView/Datasets/__snapshots__/DatasetLinks.test.jsx.snap
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,31 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`DatasetEsri renders correctly 1`] = ` | ||
<div | ||
className="item" | ||
onClick={[Function]} | ||
role="listitem" | ||
> | ||
<div | ||
className="content" | ||
> | ||
<div | ||
className="dataset-item" | ||
> | ||
<i | ||
aria-hidden="true" | ||
className="icon download" | ||
onClick={[Function]} | ||
/> | ||
<a | ||
className="item-link" | ||
href="https://example.org/1" | ||
rel="noreferrer" | ||
target="_blank" | ||
> | ||
First | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
`; |