test('renders sparkline', t => { const wrapper = shallow(<SparklineWidget socket={mockServer} name="Test" title="Sparky" />); wrapper.setState({ value: [1, 2, 3, 4] }); t.is(wrapper.find('.sparkline').length, 1); t.is(wrapper.find('.sparkline').children().length, 1); });
describe('<SidebarLeft />', () => { it('renders SidebarLeft correctly', () => { const wrapper = shallow(<SidebarLeft user={user} users={[user]} rooms={rooms} switchRoom={() => { }} />); expect(wrapper).toMatchSnapshot(); expect(wrapper.find('#avatar').prop('src')).toEqual(user.avatar); expect(wrapper.find('#user').text()).toEqual(user.name); expect(wrapper.find('.public-chats-list').children()).toHaveLength(rooms.length); }); });
test('component structure', (t) => { t.is(wrapper.name(), 'Animatable.View') t.is(wrapper.children().length, 1) // has 1 child t.is(wrapper.children().first().name(), 'View') // that child is View const subview = wrapper.children().first() // The View should contain the icon and text t.is(subview.children().length, 2) // has 2 children })
test('Displays nothing before config loaded', () => { initialState.config.loaded = false; const output = shallow(<Application/>); expect(output.children().exists()).toBe(false); });
test('greet comp', t => { const actual = shallow($(greet)).children().length, expect = 2; t.equal(actual, expect, 'should render correctly'); t.end(); });
test('renders properly', t => { const wrapper = shallow( <App {...props} /> ); // t.is(wrapper.find('Helmet').length, 1); t.is(wrapper.find('Header').length, 1); t.is(wrapper.find('Footer').length, 1); t.is(wrapper.find('Header').prop('toggleAddPost'), wrapper.instance().toggleAddPostSection); t.truthy(wrapper.find('Header + div').hasClass(styles.container)); t.truthy(wrapper.find('Header + div').children(), children); });
test('component structure', (t) => { t.is(wrapper.name(), 'Animatable.View') t.is(wrapper.children().length, 1) // has 1 child t.is(wrapper.children().first().name(), 'View') // that child is View const subview = wrapper.children().first() // The View should contain the icon and text t.is(subview.children().length, 2) // has 2 children })
test('smile comp', t => { const actual = shallow($(smile)).children().length, expect = 3; t.equal(actual, expect, 'should render correctly'); t.end(); });