@@ -7,6 +7,8 @@ import mockery from 'mockery';
77var PullRequests ;
88var pullRequests ;
99
10+ const repository = 'plouc/mozaik' ;
11+
1012describe ( 'Github — PullRequests' , ( ) => {
1113
1214 let sandbox ;
@@ -23,7 +25,7 @@ describe('Github — PullRequests', () => {
2325
2426 beforeEach ( ( ) => {
2527 sandbox = sinon . sandbox . create ( ) ;
26- pullRequests = TestUtils . renderIntoDocument ( < PullRequests repository = "plouc/mozaik" /> ) ;
28+ pullRequests = TestUtils . renderIntoDocument ( < PullRequests repository = { repository } /> ) ;
2729 } ) ;
2830
2931 afterEach ( ( ) => {
@@ -38,9 +40,9 @@ describe('Github — PullRequests', () => {
3840
3941 it ( 'should return correct api request' , ( ) => {
4042 expect ( pullRequests . getApiRequest ( ) ) . to . eql ( {
41- id : ' github.pullRequests.plouc/mozaik' ,
43+ id : ` github.pullRequests.${ repository } ` ,
4244 params : {
43- repository : 'plouc/mozaik'
45+ repository : repository
4446 }
4547 } ) ;
4648 } ) ;
@@ -80,4 +82,16 @@ describe('Github — PullRequests', () => {
8082 let count = TestUtils . findRenderedDOMComponentWithClass ( pullRequests , 'widget__header__count' ) ;
8183 expect ( count . getDOMNode ( ) . textContent ) . to . equal ( '3' ) ;
8284 } ) ;
83- } ) ;
85+
86+ it ( 'renders default title `repository Pull Requests`' , ( ) => {
87+ let title = TestUtils . findRenderedDOMComponentWithClass ( pullRequests , 'widget__header' ) ;
88+ expect ( title . getDOMNode ( ) . textContent ) . to . contain ( `${ repository } Pull Requests` ) ;
89+ } ) ;
90+
91+ it ( 'renders custom title when supplied' , ( ) => {
92+ let customTitle = 'Custom Title' ;
93+ pullRequests = TestUtils . renderIntoDocument ( < PullRequests repository = { repository } title = { customTitle } /> )
94+ let title = TestUtils . findRenderedDOMComponentWithClass ( pullRequests , 'widget__header' ) ;
95+ expect ( title . getDOMNode ( ) . textContent ) . to . contain ( customTitle ) ;
96+ } ) ;
97+ } ) ;
0 commit comments