forked from StateVoicesNational/Spoke
-
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.
Merge branch 'benhiller-creator_id' into stage-main
- Loading branch information
Showing
7 changed files
with
104 additions
and
6 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,63 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
import React from 'react' | ||
import { mount } from 'enzyme' | ||
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider' | ||
import { CampaignList } from '../../src/containers/CampaignList' | ||
|
||
describe('Campaign list for campaign with null creator', () => { | ||
// given | ||
const campaignWithoutCreator = { | ||
id: 1, | ||
title: 'Yes on A', | ||
creator: null, | ||
} | ||
|
||
const data = { | ||
organization: { | ||
campaigns: { | ||
campaigns: [ campaignWithoutCreator ], | ||
}, | ||
}, | ||
} | ||
|
||
// when | ||
test('Renders for campaign with null creator, doesn\'t include created by', () => { | ||
const wrapper = mount( | ||
<MuiThemeProvider> | ||
<CampaignList data={data} /> | ||
</MuiThemeProvider> | ||
) | ||
expect(wrapper.text().includes('Created by')).toBeFalsy() | ||
}) | ||
}) | ||
|
||
describe('Campaign list for campaign with creator', () => { | ||
// given | ||
const campaignWithCreator = { | ||
id: 1, | ||
creator: { | ||
displayName: 'Lorem Ipsum' | ||
}, | ||
} | ||
|
||
const data = { | ||
organization: { | ||
campaigns: { | ||
campaigns: [ campaignWithCreator ], | ||
}, | ||
}, | ||
} | ||
|
||
// when | ||
test('Renders for campaign with creator, includes created by', () => { | ||
const wrapper = mount( | ||
<MuiThemeProvider> | ||
<CampaignList data={data} /> | ||
</MuiThemeProvider> | ||
) | ||
expect(wrapper.containsMatchingElement(<span> — Created by Lorem Ipsum</span>)).toBeTruthy() | ||
}) | ||
}) | ||
|
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
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