Commit d2c5b62d authored by Christoph Häfner's avatar Christoph Häfner

Add unseenMovieList to MovieChoose logic

parent 3416a8e5
Pipeline #444 passed with stages
in 10 minutes and 45 seconds
......@@ -20,7 +20,8 @@ export default class MovieChoose extends React.Component {
render() {
const collectionId = this.props.collectionId
this.movieCollection = this.props.movieCollections[collectionId]
this.movie = getUnratedAndSeenMovieFromCollection(this.movieCollection, this.props.rate.personalMovieList)
this.movie = getUnratedAndSeenMovieFromCollection(this.movieCollection,
this.props.rate.personalMovieList, this.props.rate.unseenMovieList)
return (
<MovieChooseForm onStart={this.start}
movie={this.movie} />
......
......@@ -13,9 +13,7 @@ describe('MovieChoose', () => {
}
}
},
rate: {
personalMovieList: []
}
rate: {}
}
it('should call onStart callback if start button is clicked', () => {
const props = Object.assign({
......@@ -48,4 +46,27 @@ describe('MovieChoose', () => {
chaiExpect(wrapper.text()).to.not.include('abc');
chaiExpect(wrapper.text()).to.include('xyz');
})
it('should render unrated and seen movie', () => {
const props = Object.assign(minimumRequiredProps, {
onStart: jest.fn(),
movieCollections: {
'12': {
movies: {
'1': { title: 'abc' },
'2': { title: 'xyz' },
'3': { title: 'def' }
}
}
},
rate: {
personalMovieList: ['1'],
unseenMovieList: ['2']
}
});
const wrapper = mount(<MovieChoose {...props} />);
chaiExpect(wrapper.text()).to.not.include('abc');
chaiExpect(wrapper.text()).to.not.include('xyz');
chaiExpect(wrapper.text()).to.include('def');
})
})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment