describe('Footer Component', () => { it('Ensure Footer component renders', () => { const component = mount(<Footer />); expect(component.find('footer').length).toBe(1); }); });
it('it should show clear button and remove it when value changed', () => { const wrapper = mount(<Autocompleter />); wrapper.find('input').simulate('change', {target: {value: 'a'}}); let svgList = wrapper.find('svg'); expect(wrapper.state('showClearButton')).toBe(true); expect(svgList.length).toBe(2); wrapper.find('input').simulate('change', {target: {value: ''}}); svgList = wrapper.find('svg'); expect(wrapper.state('showClearButton')).toBe(false); expect(svgList.length).toBe(1); });
test('Header component has a header image and name', (t) => { t.pass( expect(wrapper.find('img').length).toEqual(1) ) t.pass( expect(wrapper.find('h1').text()).toEqual('Zendesk Test App') ) t.end() })
describe("A suite", () => { it("contains foo", () => { assert(shallow(<Foo />).contains(<div className="foo" />)); }); it("contains .foo", () => { assert(shallow(<Foo />).is('.foo')); }); it("contains .foo length 1", () => { assert(mount(<Foo />).find('.foo').length === 1); }); });
it('should render only traces with anything other than serviceName or operationName', () => { const stubErrorLocation = {search: '?query_1.error=true&time.preset=1h'}; const wrapper = mount(<MemoryRouter><UniversalSearch.WrappedComponent location={stubErrorLocation} history={stubHistory}/></MemoryRouter>); expect(wrapper.find('.universal-search-bar-tabs__nav-text').length).to.equal(1); });
describe("A suite", function() { it("contains spec with an expectation", function() { expect(shallow(<Foo />).contains(<div className="foo" />)).to.equal(true); }); it("contains spec with an expectation", function() { expect(shallow(<Foo />).is('.foo')).to.equal(true); }); it("contains spec with an expectation", function() { expect(mount(<Foo />).find('.foo').length).to.equal(1); }); });
test('actual testing for react component', t => { const wrapper = mount(<Todo names={['Barrior', 'Tom']} />); const list = wrapper.find('ul'); t.is(list.find('li').length, 2); wrapper.find('textarea').node.value = 'Lily'; wrapper.find('textarea + button').simulate('click'); t.is(list.find('li').length, 3); });
describe("A suite", function() { it("contains spec with an expectation", function() { expect(shallow(<Foo />).contains(<div className="foo" />)).toBe(true); }); it("contains spec with an expectation", function() { expect(shallow(<Foo />).is('.foo')).toBe(true); }); it("contains spec with an expectation", function() { expect(mount(<Foo />).find('.foo').length).toBe(1); }); });
it('renders the JobListingContainer component', () => { const component = mount(<Provider store={store}> <Router> <App /> </Router> </Provider>); const wrapper = component.find(Route).find('JobsListingContainer'); //console.log(wrapper.debug()); expect(wrapper.length).toEqual(1); })
describe('Auth Layout Header Component', () => { it('Ensure Header component renders', () => { const component = mount( <BrowserRouter> <Header /> </BrowserRouter>); expect(component.find('header').length).toBe(1); }); });
it("should render the list", () => { const wrapper = mount( <Provider store={store}> <TodoListRedux /> </Provider> ); expect(wrapper.find("li").length).toBe(2); });
describe('About Screen', () => { it('contains title', () => { expect(shallow(<About />).contains(<h1>About page</h1>)).to.equal(true); }); it('contains spec with an expectation', () => { expect(shallow(<About />).is('.about')).to.equal(true); }); it('contains spec with an expectation', () => { expect(mount(<About />).find('.about').length).to.equal(1); }); });
describe('AnExample', () => { it('is a div', () => { const example = mount(<AnExample />); expect(example.find('div').length).toEqual(1); }); });
describe('AnExample', () => { it('is a div', () => { const example = mount(<AnExample />); expect(example.find('div').length).toEqual(1); }); });