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

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -