fix(curriculum): Add and modify tests to catch bad code. (#36429)
parent
8c921a05d6
commit
3a0cd56ad3
|
@ -43,8 +43,11 @@ tests:
|
|||
testString: assert((function() { const mockedComponent = Enzyme.mount(React.createElement(Calendar)); return mockedComponent.children().childAt(1).props().date })());
|
||||
- text: The <code>date</code> prop of the <code>CurrentDate</code> should contain a string of text.
|
||||
testString: assert((function() { const mockedComponent = Enzyme.mount(React.createElement(Calendar)); const prop = mockedComponent.children().childAt(1).props().date; return( typeof prop === 'string' && prop.length > 0 ); })());
|
||||
- text: The <code>date</code> prop should be generated by calling <code>Date()</code>
|
||||
testString: assert(/<CurrentDatedate={Date\(\)}\/>/.test(code.replace(/\s/g, '')))
|
||||
- text: The <code>CurrentDate</code> component should render the value from the <code>date</code> prop in the <code>p</code> tag.
|
||||
testString: assert((function() { const mockedComponent = Enzyme.mount(React.createElement(Calendar)); return mockedComponent.find('p').html().includes(Date().substr(3)); })());
|
||||
testString: let date = "dummy date"; assert((function() { const mockedComponent = Enzyme.mount(React.createElement(CurrentDate, {date})); return mockedComponent.find('p').html().includes(date); })());
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue