-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests for counting datasets within and Organization.
- Loading branch information
Alex Scott
committed
Mar 24, 2021
1 parent
7b6e1f0
commit ee20ec3
Showing
3 changed files
with
56 additions
and
23 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,11 +1,32 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import '@testing-library/jest-dom/extend-expect'; | ||
import Organization from './index'; | ||
import Organization, {countDatasetsByName} from './index'; | ||
import PublisherDatasetCountByName from '../PublisherDatasetCountByName'; | ||
|
||
const data = | ||
[{"publisher": { | ||
"@type": "org:Organization", | ||
"name": "State Economic Council" | ||
}}, | ||
{"publisher": { | ||
"@type": "org:Organization", | ||
"name": "State Economic Council" | ||
}}]; | ||
|
||
|
||
describe('<Organization />', () => { | ||
test('renders a heading', () => { | ||
render(<Organization name="DKAN" />); | ||
expect(screen.getByRole('heading', 'DKAN')).toBeInTheDocument(); | ||
}); | ||
|
||
test('Has a publisher name.', () => { | ||
expect(data[0]['publisher']['name']).toEqual("State Economic Council"); | ||
}); | ||
|
||
test('renders with a dataset link with no count', () => { | ||
render(<Organization name="DKAN" />); | ||
expect(screen.getByText('datasets')).toBeInTheDocument(); | ||
}); | ||
}); |
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