fix(curriculum): Add and modify tests to catch bad code. (#36429)

pull/36822/head
Oliver Eyton-Williams 2019-09-20 18:28:50 +02:00 committed by Randell Dawson
parent 8c921a05d6
commit 3a0cd56ad3
1 changed files with 4 additions and 1 deletions

View File

@ -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); })());
```