javascript - Testing React Components renderedComponenent.length.toEqual(1) -


i wondering why following code considered valid test on reactjs:

const children = (<h1>test</h1>); const rendercomponent = (props = {}) => shallow(   <button {...props}>     {children}   </button> );  describe("<button>", () => {    it("should render <button> without theme", () => {       const renderedcomponent = rendercomponent({         nature: "primary"       });       expect(renderedcomponent.length).toequal(1);     });  }); 

why expect rendered component.length equal 1?


Comments

Popular posts from this blog

sql - can we replace full join with union of left and right join? why not? -

javascript - Parallax scrolling and fixed footer code causing width issues -

iOS: Performance of reloading UIImage(name:...) -