2019-03-20 16:51:09 +13:00
|
|
|
import React from 'react';
|
2020-10-28 21:24:38 +13:00
|
|
|
import { shallow } from 'enzyme';
|
2019-03-20 16:51:09 +13:00
|
|
|
|
|
|
|
|
import { Album } from '../../src/js/views/Album';
|
|
|
|
|
import * as uiActions from '../../src/js/services/ui/actions';
|
|
|
|
|
import * as coreActions from '../../src/js/services/core/actions';
|
2020-10-28 21:24:38 +13:00
|
|
|
const state = require('../state');
|
2019-03-20 16:51:09 +13:00
|
|
|
|
|
|
|
|
describe('<Album />', () => {
|
2020-10-28 21:24:38 +13:00
|
|
|
const album = {
|
|
|
|
|
uri: 'jest:album:one',
|
|
|
|
|
name: 'One',
|
|
|
|
|
artists_uris: [
|
|
|
|
|
'jest:artist:alpha',
|
|
|
|
|
],
|
|
|
|
|
tracks_uris: [
|
|
|
|
|
'jest:track:one',
|
|
|
|
|
'jest:track:two',
|
|
|
|
|
],
|
|
|
|
|
wiki: 'Wiki text',
|
|
|
|
|
};
|
2019-03-20 16:51:09 +13:00
|
|
|
|
2020-10-28 21:24:38 +13:00
|
|
|
it('should render accurately', () => {
|
|
|
|
|
const dom = shallow(
|
|
|
|
|
<Album
|
2019-03-20 16:51:09 +13:00
|
|
|
album={album}
|
|
|
|
|
uiActions={uiActions}
|
|
|
|
|
coreActions={coreActions}
|
2020-08-05 20:06:30 +12:00
|
|
|
/>,
|
|
|
|
|
{
|
2020-10-28 21:24:38 +13:00
|
|
|
disableLifecycleMethods: true,
|
2020-08-05 20:06:30 +12:00
|
|
|
},
|
2020-10-28 21:24:38 +13:00
|
|
|
);
|
2019-03-22 09:02:00 +13:00
|
|
|
|
2020-10-28 21:24:38 +13:00
|
|
|
expect(dom.find('.album-view').length).toBe(1);
|
|
|
|
|
expect(dom.find('h1').text()).toEqual('One');
|
|
|
|
|
expect(dom.find('.wiki__text p').text()).toEqual('Wiki text');
|
|
|
|
|
});
|
|
|
|
|
});
|