From a958cbdbaec306fa196a353c441f5c11f9f71d95 Mon Sep 17 00:00:00 2001 From: Jon Friskics Date: Fri, 4 May 2018 17:41:07 -0400 Subject: [PATCH 01/23] allow for semicolons after export default statements in tests --- src/__tests__/part2/quiz-component-has-quiz-class.test.js | 2 +- .../quiz-question-component-has-quiz-question-class.test.js | 2 +- ...tion-button-component-has-quiz-question-button-class.test.js | 2 +- .../part5/quiz-end-component-has-quiz-end-class.test.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/__tests__/part2/quiz-component-has-quiz-class.test.js b/src/__tests__/part2/quiz-component-has-quiz-class.test.js index 4fa13ea89a..1730da0ea1 100644 --- a/src/__tests__/part2/quiz-component-has-quiz-class.test.js +++ b/src/__tests__/part2/quiz-component-has-quiz-class.test.js @@ -45,7 +45,7 @@ describe('Quiz Component', () => { assert(false, "The Quiz.js file hasn't been created yet.") } - let re = /\nexport default Quiz\s*$/g + let re = /\nexport default Quiz\;*\s*$/g let match = file.match(re) assert(match != null && match.length > 0, "We couldn't find `export default Quiz` at the end of your Quiz.js file") }) diff --git a/src/__tests__/part3/quiz-question-component-has-quiz-question-class.test.js b/src/__tests__/part3/quiz-question-component-has-quiz-question-class.test.js index 55596e50a4..7bc850986f 100644 --- a/src/__tests__/part3/quiz-question-component-has-quiz-question-class.test.js +++ b/src/__tests__/part3/quiz-question-component-has-quiz-question-class.test.js @@ -45,7 +45,7 @@ describe('QuizQuestion Component', () => { assert(false, "The QuizQuestion.js file hasn't been created yet.") } - let re = /\nexport default QuizQuestion\s*$/g + let re = /\nexport default QuizQuestion\;*\s*$/g let match = file.match(re) assert(match != null && match.length > 0, "We couldn't find `export default QuizQuestion` at the end of your QuizQuestion.js file") }) diff --git a/src/__tests__/part4/quiz-question-button-component-has-quiz-question-button-class.test.js b/src/__tests__/part4/quiz-question-button-component-has-quiz-question-button-class.test.js index 6ae9ce9daf..36acbda305 100644 --- a/src/__tests__/part4/quiz-question-button-component-has-quiz-question-button-class.test.js +++ b/src/__tests__/part4/quiz-question-button-component-has-quiz-question-button-class.test.js @@ -45,7 +45,7 @@ describe('QuizQuestionButton Component', () => { assert(false, "The QuizQuestionButton.js file hasn't been created yet.") } - let re = /\nexport default QuizQuestionButton\s*$/g + let re = /\nexport default QuizQuestionButton\;*\s*$/g let match = file.match(re) assert(match != null && match.length > 0, "We couldn't find `export default QuizQuestionButton` at the end of your QuizQuestionButton.js file") }) diff --git a/src/__tests__/part5/quiz-end-component-has-quiz-end-class.test.js b/src/__tests__/part5/quiz-end-component-has-quiz-end-class.test.js index c387d27aeb..732626e981 100644 --- a/src/__tests__/part5/quiz-end-component-has-quiz-end-class.test.js +++ b/src/__tests__/part5/quiz-end-component-has-quiz-end-class.test.js @@ -45,7 +45,7 @@ describe('QuizEnd Component', () => { assert(false, "The QuizEnd.js file hasn't been created yet.") } - let re = /\nexport default QuizEnd\s*$/g + let re = /\nexport default QuizEnd\;*\s*$/g let match = file.match(re) assert(match != null && match.length > 0, "We couldn't find `export default QuizEnd` at the end of your QuizEnd.js file") }) From 380f9a100451e6677402745faa025a34cdfaa30c Mon Sep 17 00:00:00 2001 From: Jon Friskics Date: Fri, 4 May 2018 17:51:08 -0400 Subject: [PATCH 02/23] update tests to match quizData variable using camelCase --- .../part2/quiz-component-constructor-sets-state.test.js | 4 ++-- .../quiz-component-displays-instruction-text.test.js | 4 ++-- .../part2/quiz-component-has-quiz-question-div.test.js | 1 - .../part2/quiz-component-has-render-method.test.js | 4 ++-- .../part2/quiz-component-requires-quiz-json.test.js | 8 ++++---- .../quiz-question-component-has-correct-li-value.test.js | 4 ++-- ...quiz-question-component-has-quiz-question-prop.test.js | 4 ++-- .../part3/quiz-question-displays-instruction-text.test.js | 4 ++-- ...question-button-component-displays-button-text.test.js | 4 ++-- ...question-button-component-has-button-text-prop.test.js | 1 - ...ponent-displays-quiz-question-button-component.test.js | 1 - .../part5/quiz-component-has-conditional.test.js | 1 - .../quiz-handle-click-increments-position-state.test.js | 6 +++--- src/__tests__/part6/quiz-has-onclick-handler.test.js | 1 - ...-question-button-components-have-correct-props.test.js | 8 ++++---- ...tion-component-maps-multiple-button-components.test.js | 1 - .../part6/quiz-question-has-onclick-handler.test.js | 4 ++-- ...quiz-question-component-constructor-sets-state.test.js | 1 - .../part7/quiz-question-component-shows-error-tag.test.js | 1 - .../part8/quiz-end-has-reset-click-handler.test.js | 4 ++-- .../quiz-handle-reset-click-sets-position-state.test.js | 3 +-- 21 files changed, 30 insertions(+), 39 deletions(-) diff --git a/src/__tests__/part2/quiz-component-constructor-sets-state.test.js b/src/__tests__/part2/quiz-component-constructor-sets-state.test.js index b847d521c0..aebafc6612 100644 --- a/src/__tests__/part2/quiz-component-constructor-sets-state.test.js +++ b/src/__tests__/part2/quiz-component-constructor-sets-state.test.js @@ -14,7 +14,7 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') +let quizData = require('../../quiz_data.json') describe('Quiz Component', () => { it('constructor sets the state to the quiz_data JSON @quiz-component-constructor-sets-state', () => { @@ -28,6 +28,6 @@ describe('Quiz Component', () => { } assert(quiz.state() != null, "We don't see that you're setting the state in the Quiz component constructor.") - assert(quiz.state() == quiz_data, "We can see that you're setting the state in the Quiz component constructor, but it's not loading the data from `quiz_data.json`") + assert(quiz.state() == quizData, "We can see that you're setting the state in the Quiz component constructor, but it's not loading the data from `quiz_data.json`") }) }) \ No newline at end of file diff --git a/src/__tests__/part2/quiz-component-displays-instruction-text.test.js b/src/__tests__/part2/quiz-component-displays-instruction-text.test.js index a4a41498db..aabc6403b2 100644 --- a/src/__tests__/part2/quiz-component-displays-instruction-text.test.js +++ b/src/__tests__/part2/quiz-component-displays-instruction-text.test.js @@ -14,7 +14,7 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') +let quizData = require('../../quiz_data.json') describe('Quiz Component', () => { it('displays the instruction text from JSON data @quiz-component-displays-instruction-text', () => { @@ -28,7 +28,7 @@ describe('Quiz Component', () => { } if (quiz.find('.QuizQuestion').length > 0) { - assert(quiz.find('.QuizQuestion').text() == quiz_data.quiz_questions[0].instruction_text, "The div with a className of `QuizQuestion` isn't displaying the correct instruction text.") + assert(quiz.find('.QuizQuestion').text() == quizData.quiz_questions[0].instruction_text, "The div with a className of `QuizQuestion` isn't displaying the correct instruction text.") } else { assert(false, "There is not a div with a className of QuizQuestion yet.") } diff --git a/src/__tests__/part2/quiz-component-has-quiz-question-div.test.js b/src/__tests__/part2/quiz-component-has-quiz-question-div.test.js index fcb3bf6428..872cf511f5 100644 --- a/src/__tests__/part2/quiz-component-has-quiz-question-div.test.js +++ b/src/__tests__/part2/quiz-component-has-quiz-question-div.test.js @@ -14,7 +14,6 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') describe('Quiz Component', () => { it('renders a div with a className of `QuizQuestion` @quiz-component-has-quiz-question-div', () => { diff --git a/src/__tests__/part2/quiz-component-has-render-method.test.js b/src/__tests__/part2/quiz-component-has-render-method.test.js index 4de1490806..caaa011ec9 100644 --- a/src/__tests__/part2/quiz-component-has-render-method.test.js +++ b/src/__tests__/part2/quiz-component-has-render-method.test.js @@ -14,7 +14,7 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') +let quizData = require('../../quiz_data.json') describe('Quiz Component', () => { it('has a render method that returns a single div with the text `Quiz` @quiz-component-has-render-method', () => { @@ -33,7 +33,7 @@ describe('Quiz Component', () => { let el = quiz.find('.QuizQuestion').getElements()[0]; if (el.props.className == 'QuizQuestion') { if (el.props.children == null) { - assert(el.props.children == quiz_data.quiz_questions[0].instruction_text) + assert(el.props.children == quizData.quiz_questions[0].instruction_text) } } } else if (quiz.find('QuizQuestion')) { diff --git a/src/__tests__/part2/quiz-component-requires-quiz-json.test.js b/src/__tests__/part2/quiz-component-requires-quiz-json.test.js index 9e3e9ccde4..d8b9941d57 100644 --- a/src/__tests__/part2/quiz-component-requires-quiz-json.test.js +++ b/src/__tests__/part2/quiz-component-requires-quiz-json.test.js @@ -24,24 +24,24 @@ describe('Quiz Component', () => { ast['program']['body'].forEach(element => { if (element.type == 'VariableDeclaration') { if (element.kind == 'let') { - if (element.declarations[0].id.name == 'quiz_data') { + if (element.declarations[0].id.name == 'quizData') { if (element.declarations[0].init.callee.name == 'require') { if (element.declarations[0].init.arguments[0].value == './quiz_data.json') { quiz_data_loaded_correctly = true } else { - assert(false, "We found where you're trying to require a file in the `quiz_data` variable, but it doesn't look like you're requiring the correct file.") + assert(false, "We found where you're trying to require a file in the `quizData` variable, but it doesn't look like you're requiring the correct file.") } } else { assert(false, "Make sure you're using the `require` function to load the `quiz_data.json` file into a variable.") } } else { - assert(false, "We'd like you to name your variable `quiz_data`.") + assert(false, "We'd like you to name your variable `quizData`.") } } else { assert(false, "We can't find where you're creating a variable with the `let` keyword.") } } }) - assert(quiz_data_loaded_correctly, "We can't find where you're loading the quiz_data JSON into a variable named quiz_data.") + assert(quiz_data_loaded_correctly, "We can't find where you're loading the quiz_data JSON into a variable named quizData.") }); }) \ No newline at end of file diff --git a/src/__tests__/part3/quiz-question-component-has-correct-li-value.test.js b/src/__tests__/part3/quiz-question-component-has-correct-li-value.test.js index 6d2a4edc03..2b7ae554da 100644 --- a/src/__tests__/part3/quiz-question-component-has-correct-li-value.test.js +++ b/src/__tests__/part3/quiz-question-component-has-correct-li-value.test.js @@ -23,7 +23,7 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') +let quizData = require('../../quiz_data.json') describe('QuizQuestion Component', () => { it('has li tag with correct value @quiz-question-component-has-correct-li-value', () => { @@ -52,7 +52,7 @@ describe('QuizQuestion Component', () => { // this runs after @quiz-question-component-displays-quiz-question-button-component } else { let li_contents = div.querySelectorAll('main section ul li')[0] - assert(li_contents.innerHTML == quiz_data.quiz_questions[0].answer_options[0], "You're not displaying the correct data from the `quiz_question` prop in the QuizQuestion component's JSX.") + assert(li_contents.innerHTML == quizData.quiz_questions[0].answer_options[0], "You're not displaying the correct data from the `quiz_question` prop in the QuizQuestion component's JSX.") } }) }) \ No newline at end of file diff --git a/src/__tests__/part3/quiz-question-component-has-quiz-question-prop.test.js b/src/__tests__/part3/quiz-question-component-has-quiz-question-prop.test.js index 1180b8af8d..0f4e225dc9 100644 --- a/src/__tests__/part3/quiz-question-component-has-quiz-question-prop.test.js +++ b/src/__tests__/part3/quiz-question-component-has-quiz-question-prop.test.js @@ -23,7 +23,7 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') +let quizData = require('../../quiz_data.json') describe('Quiz Component', () => { it('has QuizQuestion component with correct prop @@quiz-question-component-has-quiz-question-prop', () => { @@ -39,6 +39,6 @@ describe('Quiz Component', () => { assert(quiz.find('QuizQuestion').length == 1, "We couldn't find the QuizQuestion component being loaded by the Quiz component") assert(quiz.find('QuizQuestion').props().quiz_question != null, "The QuizQuestion component exists, but there's no prop named `quiz_question`.") - assert(quiz.find('QuizQuestion').props().quiz_question == quiz_data.quiz_questions[0], "The QuizQuestion component has a prop named `quiz_question`, but it doesn't contain the correct value.") + assert(quiz.find('QuizQuestion').props().quiz_question == quizData.quiz_questions[0], "The QuizQuestion component has a prop named `quiz_question`, but it doesn't contain the correct value.") }) }) \ No newline at end of file diff --git a/src/__tests__/part3/quiz-question-displays-instruction-text.test.js b/src/__tests__/part3/quiz-question-displays-instruction-text.test.js index 3d49f14d8f..bab2f7de7f 100644 --- a/src/__tests__/part3/quiz-question-displays-instruction-text.test.js +++ b/src/__tests__/part3/quiz-question-displays-instruction-text.test.js @@ -23,7 +23,7 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') +let quizData = require('../../quiz_data.json') describe('QuizQuestion Component', () => { it('displays correct instruction text @quiz-question-displays-instruction-text', () => { @@ -49,6 +49,6 @@ describe('QuizQuestion Component', () => { assert(div.querySelector('main') != null, "no main") assert(div.querySelectorAll('main section p').length != 0, "We can't find a paragraph tag inside of the first section tag in the QuizQuestion component's JSX.") let p_contents = div.querySelectorAll('main section p')[0] - assert(p_contents.innerHTML == quiz_data.quiz_questions[0].instruction_text, "You're not displaying the correct data from the `quiz_question` prop in the QuizQuestion component's JSX.") + assert(p_contents.innerHTML == quizData.quiz_questions[0].instruction_text, "You're not displaying the correct data from the `quiz_question` prop in the QuizQuestion component's JSX.") }) }) \ No newline at end of file diff --git a/src/__tests__/part4/quiz-question-button-component-displays-button-text.test.js b/src/__tests__/part4/quiz-question-button-component-displays-button-text.test.js index bf1f0f3292..0145004608 100644 --- a/src/__tests__/part4/quiz-question-button-component-displays-button-text.test.js +++ b/src/__tests__/part4/quiz-question-button-component-displays-button-text.test.js @@ -14,7 +14,7 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') +let quizData = require('../../quiz_data.json') describe('QuizQuestionButton Component', () => { it('displays correct button text @quiz-question-button-component-displays-button-text', () => { @@ -35,6 +35,6 @@ describe('QuizQuestionButton Component', () => { assert(div.querySelector('li button') != null, "no li button") let button_contents = div.querySelectorAll('li button')[0] - assert(button_contents.innerHTML == quiz_data.quiz_questions[0].answer_options[0], "You're not displaying the correct data from the `button_text` prop in the QuizQuestionButton component's JSX.") + assert(button_contents.innerHTML == quizData.quiz_questions[0].answer_options[0], "You're not displaying the correct data from the `button_text` prop in the QuizQuestionButton component's JSX.") }) }) \ No newline at end of file diff --git a/src/__tests__/part4/quiz-question-button-component-has-button-text-prop.test.js b/src/__tests__/part4/quiz-question-button-component-has-button-text-prop.test.js index 4e66e6a327..7a701a30df 100644 --- a/src/__tests__/part4/quiz-question-button-component-has-button-text-prop.test.js +++ b/src/__tests__/part4/quiz-question-button-component-has-button-text-prop.test.js @@ -23,7 +23,6 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') describe('QuizQuestion Component', () => { it('has QuizQuestionButton component with correct prop @quiz-question-button-component-has-button-text-prop', () => { diff --git a/src/__tests__/part4/quiz-question-component-displays-quiz-question-button-component.test.js b/src/__tests__/part4/quiz-question-component-displays-quiz-question-button-component.test.js index 1574236eb6..f2c214758b 100644 --- a/src/__tests__/part4/quiz-question-component-displays-quiz-question-button-component.test.js +++ b/src/__tests__/part4/quiz-question-component-displays-quiz-question-button-component.test.js @@ -23,7 +23,6 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') describe('QuizQuestion Component', () => { it('renders QuizQuestionButton component @quiz-question-component-displays-quiz-question-button-component', () => { diff --git a/src/__tests__/part5/quiz-component-has-conditional.test.js b/src/__tests__/part5/quiz-component-has-conditional.test.js index e8d9f3e0e9..7e9a7c9de1 100644 --- a/src/__tests__/part5/quiz-component-has-conditional.test.js +++ b/src/__tests__/part5/quiz-component-has-conditional.test.js @@ -14,7 +14,6 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') let babylon = require("babylon"); describe('Quiz Component', () => { diff --git a/src/__tests__/part6/quiz-handle-click-increments-position-state.test.js b/src/__tests__/part6/quiz-handle-click-increments-position-state.test.js index 783cf47da1..5cbd28ba00 100644 --- a/src/__tests__/part6/quiz-handle-click-increments-position-state.test.js +++ b/src/__tests__/part6/quiz-handle-click-increments-position-state.test.js @@ -15,7 +15,7 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') +let quizData = require('../../quiz_data.json') let babylon = require('babylon') describe('Quiz Component', () => { @@ -31,14 +31,14 @@ describe('Quiz Component', () => { } if (quiz.state().quiz_position) { - assert(quiz.state().quiz_position == quiz_data.quiz_position, "The Quiz component's state does not have a key named `quiz_position` with the correct value - are you sure you're still setting the component's state to `quiz_data`?") + assert(quiz.state().quiz_position == quizData.quiz_position, "The Quiz component's state does not have a key named `quiz_position` with the correct value - are you sure you're still setting the component's state to `quizData`?") try { quiz.instance().handleClick() } catch (e) { assert(false, "There's not a method named `handleClick()` in the Quiz class.") } - assert(quiz.state().quiz_position == quiz_data.quiz_position + 1, "The Quiz component state's `quiz_position` value is not being incremented by 1 when the `handleClick()` method is called.") + assert(quiz.state().quiz_position == quizData.quiz_position + 1, "The Quiz component state's `quiz_position` value is not being incremented by 1 when the `handleClick()` method is called.") } }) }) \ No newline at end of file diff --git a/src/__tests__/part6/quiz-has-onclick-handler.test.js b/src/__tests__/part6/quiz-has-onclick-handler.test.js index 5c96e58814..ff80597e99 100644 --- a/src/__tests__/part6/quiz-has-onclick-handler.test.js +++ b/src/__tests__/part6/quiz-has-onclick-handler.test.js @@ -15,7 +15,6 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') let babylon = require('babylon') describe('Quiz Component', () => { diff --git a/src/__tests__/part6/quiz-question-button-components-have-correct-props.test.js b/src/__tests__/part6/quiz-question-button-components-have-correct-props.test.js index 51b3cce011..074225e99f 100644 --- a/src/__tests__/part6/quiz-question-button-components-have-correct-props.test.js +++ b/src/__tests__/part6/quiz-question-button-components-have-correct-props.test.js @@ -23,7 +23,7 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') +let quizData = require('../../quiz_data.json') describe('QuizQuestion Component', () => { it('has QuizQuestionButton components with correct props @quiz-question-button-component-has-correct-props', () => { @@ -45,11 +45,11 @@ describe('QuizQuestion Component', () => { let expectedPropsFirst = { key: 0, - button_text: quiz_data.quiz_questions[0].answer_options[0] + button_text: quizData.quiz_questions[0].answer_options[0] } let expectedPropsLast = { key: 3, - button_text: quiz_data.quiz_questions[0].answer_options[quiz_data.quiz_questions[0].answer_options.length-1] + button_text: quizData.quiz_questions[0].answer_options[quizData.quiz_questions[0].answer_options.length-1] } if (quizQuestion.find('QuizQuestionButton').length == 1) { @@ -59,7 +59,7 @@ describe('QuizQuestion Component', () => { // this will run after @quiz-question-component-maps-multiple-button-components quizQuestion.find('QuizQuestionButton').forEach((n, index) => { let expectedProps = { - button_text: quiz_data.quiz_questions[0].answer_options[index] + button_text: quizData.quiz_questions[0].answer_options[index] } assert(n.key() == index, "It doesn't look like the QuizQuestionButton component's `key` props have the correct values.") assert(JSON.stringify(n.props()) == JSON.stringify(expectedProps), "It doesn't look like the QuizQuestionButton component's `button_text` props have the correct values.") diff --git a/src/__tests__/part6/quiz-question-component-maps-multiple-button-components.test.js b/src/__tests__/part6/quiz-question-component-maps-multiple-button-components.test.js index a142c77c28..f0cd806b99 100644 --- a/src/__tests__/part6/quiz-question-component-maps-multiple-button-components.test.js +++ b/src/__tests__/part6/quiz-question-component-maps-multiple-button-components.test.js @@ -14,7 +14,6 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') let babylon = require("babylon"); describe('QuizQuestion Component', () => { diff --git a/src/__tests__/part6/quiz-question-has-onclick-handler.test.js b/src/__tests__/part6/quiz-question-has-onclick-handler.test.js index 247a4a76e9..4befaaacc3 100644 --- a/src/__tests__/part6/quiz-question-has-onclick-handler.test.js +++ b/src/__tests__/part6/quiz-question-has-onclick-handler.test.js @@ -15,7 +15,7 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') +let quizData = require('../../quiz_data.json') let babylon = require('babylon') describe('QuizQuestion Component', () => { @@ -35,7 +35,7 @@ describe('QuizQuestion Component', () => { assert(false, "We weren't able to mount the QuizQuestion component") } - assert(quizQuestion.find('QuizQuestionButton').length == quiz_data.quiz_questions[0].answer_options.length, "The number of QuizQuestionButton components that are rendered by the QuizQuestion component don't match the number of `answer_options` in the JSON data") + assert(quizQuestion.find('QuizQuestionButton').length == quizData.quiz_questions[0].answer_options.length, "The number of QuizQuestionButton components that are rendered by the QuizQuestion component don't match the number of `answer_options` in the JSON data") assert(quizQuestion.find('QuizQuestionButton').first().props().clickHandler != null, "The QuizQuestionButton tag in QuizQuestion's JSX doesn't have a `clickHandler` property") diff --git a/src/__tests__/part7/quiz-question-component-constructor-sets-state.test.js b/src/__tests__/part7/quiz-question-component-constructor-sets-state.test.js index 42f9dd86ee..67459029ac 100644 --- a/src/__tests__/part7/quiz-question-component-constructor-sets-state.test.js +++ b/src/__tests__/part7/quiz-question-component-constructor-sets-state.test.js @@ -14,7 +14,6 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') describe('QuizQuestion Component', () => { it('constructor sets the state key `incorrectAnswer` to `false` @quiz-question-component-constructor-sets-state', () => { diff --git a/src/__tests__/part7/quiz-question-component-shows-error-tag.test.js b/src/__tests__/part7/quiz-question-component-shows-error-tag.test.js index 46edbc5975..a0ea52250a 100644 --- a/src/__tests__/part7/quiz-question-component-shows-error-tag.test.js +++ b/src/__tests__/part7/quiz-question-component-shows-error-tag.test.js @@ -14,7 +14,6 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') describe('QuizQuestion Component', () => { it('shows error paragraph tag if incorrectAnswer is true @quiz-question-component-shows-error-tag', () => { diff --git a/src/__tests__/part8/quiz-end-has-reset-click-handler.test.js b/src/__tests__/part8/quiz-end-has-reset-click-handler.test.js index 1392fd6b41..1157906eba 100644 --- a/src/__tests__/part8/quiz-end-has-reset-click-handler.test.js +++ b/src/__tests__/part8/quiz-end-has-reset-click-handler.test.js @@ -24,7 +24,7 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') +let quizData = require('../../quiz_data.json') let babylon = require('babylon') describe('QuizEnd Component', () => { @@ -40,7 +40,7 @@ describe('QuizEnd Component', () => { assert(false, "We weren't able to mount the Quiz component") } - quiz.setState({ quiz_position: quiz_data.quiz_questions.length + 1 }) + quiz.setState({ quiz_position: quizData.quiz_questions.length + 1 }) assert(quiz.instance().handleResetClick, "There doesn't appear to be a method named `handleResetClick()` in the Quiz component.") diff --git a/src/__tests__/part8/quiz-handle-reset-click-sets-position-state.test.js b/src/__tests__/part8/quiz-handle-reset-click-sets-position-state.test.js index 67d11013c0..1d29a91f57 100644 --- a/src/__tests__/part8/quiz-handle-reset-click-sets-position-state.test.js +++ b/src/__tests__/part8/quiz-handle-reset-click-sets-position-state.test.js @@ -15,7 +15,6 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') let babylon = require('babylon') describe('Quiz Component', () => { @@ -32,7 +31,7 @@ describe('Quiz Component', () => { quiz.setState({ quiz_position: 3 }) - assert(quiz.state().quiz_position == 3, "The Quiz component's state does not have a key named `quiz_position` with the correct value - are you sure you're still setting the component's state to `quiz_data`?") + assert(quiz.state().quiz_position == 3, "The Quiz component's state does not have a key named `quiz_position` with the correct value - are you sure you're still setting the component's state to `quizData`?") try { quiz.instance().handleResetClick() From 7dff3ddfdfd0fc62c3f449e2d6cdb409d2250913 Mon Sep 17 00:00:00 2001 From: Jon Friskics Date: Sat, 5 May 2018 00:23:31 -0400 Subject: [PATCH 03/23] update test runner commands to use the word module instead of part --- package.json | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index bbc3c54365..f6461d5fef 100644 --- a/package.json +++ b/package.json @@ -11,20 +11,21 @@ "start": "react-scripts start", "build": "react-scripts build", "test": "./node_modules/.bin/cross-env react-scripts test --env=jsdom", - "test:part2": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part2", - "test:part3": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part3", - "test:part4": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part4", - "test:part5": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part5", - "test:part6": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part6", - "test:part7": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part7", + "test:module1": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part2", + "test:module2": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part3", + "test:module3": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part4", + "test:module4": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part5", + "test:module5": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part6", + "test:module6": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part7", + "test:module7": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part8", "test:part8": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part8", - "tutor-test:part2": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part2", - "tutor-test:part3": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part3", - "tutor-test:part4": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part4", - "tutor-test:part5": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part5", - "tutor-test:part6": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part6", - "tutor-test:part7": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part7", - "tutor-test:part8": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part8", + "tutor-test:module1": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part2", + "tutor-test:module2": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part3", + "tutor-test:module3": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part4", + "tutor-test:module4": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part5", + "tutor-test:module5": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part6", + "tutor-test:module6": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part7", + "tutor-test:module7": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part8", "tutor-test": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace", "eject": "react-scripts eject" }, From d77018e0e3801d5eea2fc24dbe4dd1f68fab8c27 Mon Sep 17 00:00:00 2001 From: Jon Friskics Date: Sat, 5 May 2018 00:24:09 -0400 Subject: [PATCH 04/23] update tests after run-through --- .../quiz-component-constructor-sets-state.test.js | 7 +++++-- .../quiz-component-displays-instruction-text.test.js | 1 + .../quiz-component-has-quiz-question-div.test.js | 1 + ...omponent-displays-quiz-question-component.test.js | 4 ++-- ...question-component-has-quiz-question-prop.test.js | 4 ++-- ...ion-button-component-has-button-text-prop.test.js | 2 ++ ...uiz-component-displays-quiz-end-component.test.js | 1 - .../part5/quiz-component-has-conditional.test.js | 3 ++- .../quiz-component-has-is-quiz-end-const.test.js | 6 +++--- ...est.js => quiz-has-next-question-handler.test.js} | 6 +++--- ...handle-click-method-returns-correct-value.test.js | 8 ++++---- ...-next-question-increments-position-state.test.js} | 12 ++++++------ ...uiz-question-component-sets-correct-state.test.js | 6 +++--- 13 files changed, 34 insertions(+), 27 deletions(-) rename src/__tests__/part6/{quiz-has-onclick-handler.test.js => quiz-has-next-question-handler.test.js} (58%) rename src/__tests__/part6/{quiz-handle-click-increments-position-state.test.js => quiz-show-next-question-increments-position-state.test.js} (52%) diff --git a/src/__tests__/part2/quiz-component-constructor-sets-state.test.js b/src/__tests__/part2/quiz-component-constructor-sets-state.test.js index aebafc6612..f15043246b 100644 --- a/src/__tests__/part2/quiz-component-constructor-sets-state.test.js +++ b/src/__tests__/part2/quiz-component-constructor-sets-state.test.js @@ -14,7 +14,6 @@ try { } let fs = require('fs'); -let quizData = require('../../quiz_data.json') describe('Quiz Component', () => { it('constructor sets the state to the quiz_data JSON @quiz-component-constructor-sets-state', () => { @@ -27,7 +26,11 @@ describe('Quiz Component', () => { assert(false, "We weren't able to mount the Quiz component") } + let expectedState = { + quiz_position: 1 + } + assert(quiz.state() != null, "We don't see that you're setting the state in the Quiz component constructor.") - assert(quiz.state() == quizData, "We can see that you're setting the state in the Quiz component constructor, but it's not loading the data from `quiz_data.json`") + assert(JSON.stringify(quiz.state()) == JSON.stringify(expectedState), "We can see that you're setting the state in the Quiz component constructor, but that state isn't a key `quiz_position` with a value of `1`.") }) }) \ No newline at end of file diff --git a/src/__tests__/part2/quiz-component-displays-instruction-text.test.js b/src/__tests__/part2/quiz-component-displays-instruction-text.test.js index aabc6403b2..1887903f0b 100644 --- a/src/__tests__/part2/quiz-component-displays-instruction-text.test.js +++ b/src/__tests__/part2/quiz-component-displays-instruction-text.test.js @@ -29,6 +29,7 @@ describe('Quiz Component', () => { if (quiz.find('.QuizQuestion').length > 0) { assert(quiz.find('.QuizQuestion').text() == quizData.quiz_questions[0].instruction_text, "The div with a className of `QuizQuestion` isn't displaying the correct instruction text.") + } else if (quiz.find('QuizQuestion')) { } else { assert(false, "There is not a div with a className of QuizQuestion yet.") } diff --git a/src/__tests__/part2/quiz-component-has-quiz-question-div.test.js b/src/__tests__/part2/quiz-component-has-quiz-question-div.test.js index 872cf511f5..57160145f6 100644 --- a/src/__tests__/part2/quiz-component-has-quiz-question-div.test.js +++ b/src/__tests__/part2/quiz-component-has-quiz-question-div.test.js @@ -36,6 +36,7 @@ describe('Quiz Component', () => { assert(el.props.children == 'How many continents are there on Planet Earth?') } } + } else if (quiz.find('QuizQuestion')) { } else if (quiz.containsMatchingElement(
Quiz
)) { // this block will run until @quiz-component-has-quiz-question-div assert(false, "The Quiz component isn't rendering a single div with the class `QuizQuestion`") diff --git a/src/__tests__/part3/quiz-component-displays-quiz-question-component.test.js b/src/__tests__/part3/quiz-component-displays-quiz-question-component.test.js index 70884043fc..6a70db203b 100644 --- a/src/__tests__/part3/quiz-component-displays-quiz-question-component.test.js +++ b/src/__tests__/part3/quiz-component-displays-quiz-question-component.test.js @@ -26,8 +26,8 @@ let fs = require('fs'); describe('Quiz Component', () => { it('displays the QuizQuestion component @quiz-component-displays-quiz-question-component', () => { - assert(quizQuestionComponentExists, "The Quiz component hasn't been created yet.") - assert(quizComponentExists, "The QuizQuestion component hasn't been created yet.") + assert(quizQuestionComponentExists, "The QuizQuestion component hasn't been created yet.") + assert(quizComponentExists, "The Quiz component hasn't been created yet.") let quiz; try { diff --git a/src/__tests__/part3/quiz-question-component-has-quiz-question-prop.test.js b/src/__tests__/part3/quiz-question-component-has-quiz-question-prop.test.js index 0f4e225dc9..e26f2d868c 100644 --- a/src/__tests__/part3/quiz-question-component-has-quiz-question-prop.test.js +++ b/src/__tests__/part3/quiz-question-component-has-quiz-question-prop.test.js @@ -27,8 +27,8 @@ let quizData = require('../../quiz_data.json') describe('Quiz Component', () => { it('has QuizQuestion component with correct prop @@quiz-question-component-has-quiz-question-prop', () => { - assert(quizQuestionComponentExists, "The Quiz component hasn't been created yet.") - assert(quizComponentExists, "The QuizQuestion component hasn't been created yet.") + assert(quizQuestionComponentExists, "The QuizQuestion component hasn't been created yet.") + assert(quizComponentExists, "The Quiz component hasn't been created yet.") let quiz; try { diff --git a/src/__tests__/part4/quiz-question-button-component-has-button-text-prop.test.js b/src/__tests__/part4/quiz-question-button-component-has-button-text-prop.test.js index 7a701a30df..8f1e246d6e 100644 --- a/src/__tests__/part4/quiz-question-button-component-has-button-text-prop.test.js +++ b/src/__tests__/part4/quiz-question-button-component-has-button-text-prop.test.js @@ -47,6 +47,8 @@ describe('QuizQuestion Component', () => { } if (quizQuestion.find('QuizQuestionButton').length == 1) { assert(JSON.stringify(quizQuestion.find('QuizQuestionButton').props()) == JSON.stringify(expectedProps), "You're not passing the correct prop values to QuizQuestionButton.") + } else if (quizQuestion.find('QuizQuestionButton').length == 4) { + } else { assert(false, "We don't see the QuizQuestionButton element in the QuizQuestion component's JSX.") } diff --git a/src/__tests__/part5/quiz-component-displays-quiz-end-component.test.js b/src/__tests__/part5/quiz-component-displays-quiz-end-component.test.js index c21ec10b3d..c6575d2c21 100644 --- a/src/__tests__/part5/quiz-component-displays-quiz-end-component.test.js +++ b/src/__tests__/part5/quiz-component-displays-quiz-end-component.test.js @@ -23,7 +23,6 @@ try { } let fs = require('fs'); -let quiz_data = require('../../quiz_data.json') let babylon = require("babylon"); describe('Quiz Component', () => { diff --git a/src/__tests__/part5/quiz-component-has-conditional.test.js b/src/__tests__/part5/quiz-component-has-conditional.test.js index 7e9a7c9de1..3ebc0b4e10 100644 --- a/src/__tests__/part5/quiz-component-has-conditional.test.js +++ b/src/__tests__/part5/quiz-component-has-conditional.test.js @@ -14,6 +14,7 @@ try { } let fs = require('fs'); +let quizData = require('../../quiz_data.json') let babylon = require("babylon"); describe('Quiz Component', () => { @@ -30,7 +31,7 @@ describe('Quiz Component', () => { if (yallReadyForThis()) { assert(quiz.find('QuizQuestion').length == 1 && quiz.find('QuizEnd').length == 0, "QuizQuestion should be displaying when isQuizEnd is false") - quiz.setState({quiz_position: quiz.state().quiz_questions.length+1 }) + quiz.setState({quiz_position: quizData.quiz_questions.length+1 }) assert(quiz.find('QuizQuestion').length == 0 && quiz.find('QuizEnd').length == 1, "QuizEnd should be displaying when isQuizEnd is true") } else { assert(false, "We couldn't find a const named `isQuizEnd`.") diff --git a/src/__tests__/part5/quiz-component-has-is-quiz-end-const.test.js b/src/__tests__/part5/quiz-component-has-is-quiz-end-const.test.js index feb59b6c51..ad3d4fe6d5 100644 --- a/src/__tests__/part5/quiz-component-has-is-quiz-end-const.test.js +++ b/src/__tests__/part5/quiz-component-has-is-quiz-end-const.test.js @@ -36,10 +36,10 @@ describe('Quiz Component', () => { is_quiz_end_count = is_quiz_end_count + 1 if (el3.init.type == 'BinaryExpression') { let statement = file.substring(el3.init.start-20, el3.init.end) - let re = /isQuizEnd\s*=\s*\(?\s*this\.state\.quiz_position\s*-\s*1\s*===?\s*this\.state\.quiz_questions\.length\)?/g + let re = /isQuizEnd\s*=\s*\(?\s*\(?\s*this\.state\.quiz_position\s*-\s*1\s*\)?\s*===?\s*quizData\.quiz_questions\.length\)?/g let match = statement.match(re) - assert(match != null, "We can't find where you're writing an expression that checks if `this.state.quiz_position - 1` is equivalent to `this.state.quiz_questions.length`") - assert(match.length == 1, "We can't find where you're writing an expression that checks if `this.state.quiz_position - 1` is equivalent to `this.state.quiz_questions.length`") + assert(match != null, "We can't find where you're writing an expression that checks if `this.state.quiz_position - 1` is equivalent to `quizData.quiz_questions.length`") + assert(match.length == 1, "We can't find where you're writing an expression that checks if `this.state.quiz_position - 1` is equivalent to `quizData.quiz_questions.length`") } } }) diff --git a/src/__tests__/part6/quiz-has-onclick-handler.test.js b/src/__tests__/part6/quiz-has-next-question-handler.test.js similarity index 58% rename from src/__tests__/part6/quiz-has-onclick-handler.test.js rename to src/__tests__/part6/quiz-has-next-question-handler.test.js index ff80597e99..3446ec0683 100644 --- a/src/__tests__/part6/quiz-has-onclick-handler.test.js +++ b/src/__tests__/part6/quiz-has-next-question-handler.test.js @@ -18,7 +18,7 @@ let fs = require('fs'); let babylon = require('babylon') describe('Quiz Component', () => { - it('has a method named `handleClick` and a renders a QuizQuestion component with a `clickHandler` prop @quiz-has-onclick-handler', () => { + it('has a method named `showNextQuestion` and a renders a QuizQuestion component with a `showNextQuestionHandler` prop @quiz-has-next-question-handler', () => { assert(quizComponentExists, "The Quiz component hasn't been created yet.") let quiz; @@ -31,9 +31,9 @@ describe('Quiz Component', () => { assert(quiz.find('QuizQuestion').length == 1, "We couldn't find the QuizQuestion component in the Quiz component's JSX.") - assert(quiz.find('QuizQuestion').props().clickHandler != null, "The QuizQuestion tag in Quiz's JSX doesn't have a `clickHandler` property.") + assert(quiz.find('QuizQuestion').props().showNextQuestionHandler != null, "The QuizQuestion tag in Quiz's JSX doesn't have a `showNextQuestionHandler` property.") - assert(quiz.find('QuizQuestion').props().clickHandler.name == 'bound handleClick', "The QuizQuestion tag in Quiz's JSX has a `clickHandler` property, but the value isn't set to `this.handleClick.bind(this)`.") + assert(quiz.find('QuizQuestion').props().showNextQuestionHandler.name == 'bound showNextQuestion', "The QuizQuestion tag in Quiz's JSX has a `showNextQuestionHandler` property, but the value isn't set to `this.showNextQuestion.bind(this)`.") }) }) \ No newline at end of file diff --git a/src/__tests__/part6/quiz-question-handle-click-method-returns-correct-value.test.js b/src/__tests__/part6/quiz-question-handle-click-method-returns-correct-value.test.js index 6782467611..848ebea69d 100644 --- a/src/__tests__/part6/quiz-question-handle-click-method-returns-correct-value.test.js +++ b/src/__tests__/part6/quiz-question-handle-click-method-returns-correct-value.test.js @@ -55,9 +55,9 @@ describe('QuizQuestion Component', () => { let spy2 try { - spy2 = sinon.spy(Quiz.prototype, 'handleClick') + spy2 = sinon.spy(Quiz.prototype, 'showNextQuestion') } catch (e) { - assert(false, "There's not a method named `handleClick()` in the Quiz class.") + assert(false, "There's not a method named `showNextQuestion()` in the Quiz class.") } let mockedPropHandler = sinon.spy() @@ -70,7 +70,7 @@ describe('QuizQuestion Component', () => { let quizQuestion try { - quizQuestion = shallow() + quizQuestion = shallow() } catch (e) { assert(false, "We weren't able to mount the QuizQuestion component") } @@ -81,6 +81,6 @@ describe('QuizQuestion Component', () => { quizQuestion.instance().handleClick('5') } catch (e) { } - assert(spy2.called == true, "`this.props.clickHandler()` is not being called when the `buttonText` is equal to `this.props.quiz_question.answer` in QuizQuestion's `handleClick` method.") + assert(spy2.called == true, "`this.props.showNextQuestionHandler()` is not being called when the `buttonText` is equal to `this.props.quiz_question.answer` in QuizQuestion's `handleClick` method.") }) }) \ No newline at end of file diff --git a/src/__tests__/part6/quiz-handle-click-increments-position-state.test.js b/src/__tests__/part6/quiz-show-next-question-increments-position-state.test.js similarity index 52% rename from src/__tests__/part6/quiz-handle-click-increments-position-state.test.js rename to src/__tests__/part6/quiz-show-next-question-increments-position-state.test.js index 5cbd28ba00..7b1bd7ab03 100644 --- a/src/__tests__/part6/quiz-handle-click-increments-position-state.test.js +++ b/src/__tests__/part6/quiz-show-next-question-increments-position-state.test.js @@ -19,7 +19,7 @@ let quizData = require('../../quiz_data.json') let babylon = require('babylon') describe('Quiz Component', () => { - it('handleClick() method increments the quiz_position by 1 @quiz-handle-click-increments-position-state', () => { + it('showNextQuestion() method increments the quiz_position by 1 @quiz-show-next-question-increments-position-state', () => { assert(quizComponentExists, "The Quiz component hasn't been created yet.") let quiz; @@ -31,14 +31,14 @@ describe('Quiz Component', () => { } if (quiz.state().quiz_position) { - assert(quiz.state().quiz_position == quizData.quiz_position, "The Quiz component's state does not have a key named `quiz_position` with the correct value - are you sure you're still setting the component's state to `quizData`?") + assert(quiz.state().quiz_position == 1, "The Quiz component's state does not have a key named `quiz_position` with the correct value - are you sure you're still setting the component's state to `quizData`?") + let prev_position = quiz.state().quiz_position try { - quiz.instance().handleClick() + quiz.instance().showNextQuestion() } catch (e) { - assert(false, "There's not a method named `handleClick()` in the Quiz class.") + assert(false, "There's not a method named `showNextQuestion()` in the Quiz class.") } - - assert(quiz.state().quiz_position == quizData.quiz_position + 1, "The Quiz component state's `quiz_position` value is not being incremented by 1 when the `handleClick()` method is called.") + assert(quiz.state().quiz_position == prev_position + 1, "The Quiz component state's `quiz_position` value is not being incremented by 1 when the `showNextQuestion()` method is called.") } }) }) \ No newline at end of file diff --git a/src/__tests__/part7/quiz-question-component-sets-correct-state.test.js b/src/__tests__/part7/quiz-question-component-sets-correct-state.test.js index 3191592fbe..23377048ae 100644 --- a/src/__tests__/part7/quiz-question-component-sets-correct-state.test.js +++ b/src/__tests__/part7/quiz-question-component-sets-correct-state.test.js @@ -47,9 +47,9 @@ describe('QuizQuestion Component', () => { let spy2 try { - spy2 = sinon.spy(Quiz.prototype, 'handleClick') + spy2 = sinon.spy(Quiz.prototype, 'showNextQuestion') } catch (e) { - assert(false, "There's not a method named `handleClick()` in the Quiz class.") + assert(false, "There's not a method named `showNextQuestion()` in the Quiz class.") } let mockedPropHandler = sinon.spy() @@ -62,7 +62,7 @@ describe('QuizQuestion Component', () => { let quizQuestion try { - quizQuestion = shallow() + quizQuestion = shallow() } catch (e) { assert(false, "We weren't able to mount the QuizQuestion component") } From 617f53cfc3fad26d46f69cc1d4ec62d6ee95ca5a Mon Sep 17 00:00:00 2001 From: Jon Friskics Date: Sat, 5 May 2018 00:24:31 -0400 Subject: [PATCH 05/23] refactor quiz data JSON to remove quiz_position --- src/quiz_data.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/quiz_data.json b/src/quiz_data.json index 70975b474a..fbc0a6e096 100644 --- a/src/quiz_data.json +++ b/src/quiz_data.json @@ -12,6 +12,5 @@ "answer_options": ["1", "2", "3", "4"], "answer": "4" } - ], - "quiz_position": 1 + ] } \ No newline at end of file From 71210638658a8d55fa70f32fd0888cf845f42059 Mon Sep 17 00:00:00 2001 From: Jon Friskics Date: Sat, 5 May 2018 13:26:29 -0400 Subject: [PATCH 06/23] refactor test to use JSON data instead of hard-coded string --- .../quiz-component-has-quiz-question-div.test.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/__tests__/part2/quiz-component-has-quiz-question-div.test.js b/src/__tests__/part2/quiz-component-has-quiz-question-div.test.js index 57160145f6..42145f92f9 100644 --- a/src/__tests__/part2/quiz-component-has-quiz-question-div.test.js +++ b/src/__tests__/part2/quiz-component-has-quiz-question-div.test.js @@ -14,6 +14,7 @@ try { } let fs = require('fs'); +let quizData = require('../../quiz_data.json') describe('Quiz Component', () => { it('renders a div with a className of `QuizQuestion` @quiz-component-has-quiz-question-div', () => { @@ -23,25 +24,25 @@ describe('Quiz Component', () => { try { quiz = shallow() } catch (e) { - assert(false, "We weren't able to mount the Quiz component") + assert(false, "We weren't able to mount the Quiz component.") } if (quiz.containsMatchingElement(
)) { // this block will run after @quiz-component-has-quiz-question-div - assert(quiz.containsMatchingElement(
), "The Quiz component isn't rendering a single div with the class `QuizQuestion`") + assert(quiz.containsMatchingElement(
), "The Quiz component isn't rendering a single div with the class `QuizQuestion`.") } else if ( quiz.find('.QuizQuestion').getElements().length == 1) { let el = quiz.find('.QuizQuestion').getElements()[0]; if (el.props.className == 'QuizQuestion') { if (el.props.children == null) { - assert(el.props.children == 'How many continents are there on Planet Earth?') + assert(el.props.children == quizData.quiz_questions[0].instruction_text) } } } else if (quiz.find('QuizQuestion')) { } else if (quiz.containsMatchingElement(
Quiz
)) { // this block will run until @quiz-component-has-quiz-question-div - assert(false, "The Quiz component isn't rendering a single div with the class `QuizQuestion`") + assert(false, "The Quiz component isn't rendering a single div with the class `QuizQuestion`.") } else { - assert(false, "The Quiz component isn't rendering a single div with the class `QuizQuestion`") + assert(false, "The Quiz component isn't rendering a single div with the class `QuizQuestion`.") } }) From 68e0970bf7b1dd06ac729d7386ce11ee94a24fa6 Mon Sep 17 00:00:00 2001 From: Jon Friskics Date: Sat, 5 May 2018 13:29:37 -0400 Subject: [PATCH 07/23] replace temporary failure messages with real ones --- ...question-component-has-correct-li-value.test.js | 4 ++-- ...iz-question-component-has-render-method.test.js | 12 ++++++------ ...quiz-question-displays-instruction-text.test.js | 6 +++--- ...n-button-component-displays-button-text.test.js | 4 ++-- ...tion-button-component-has-render-method.test.js | 8 ++++---- ...displays-quiz-question-button-component.test.js | 6 +++--- .../quiz-end-component-has-render-method.test.js | 14 +++++++------- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/__tests__/part3/quiz-question-component-has-correct-li-value.test.js b/src/__tests__/part3/quiz-question-component-has-correct-li-value.test.js index 2b7ae554da..1d8b982920 100644 --- a/src/__tests__/part3/quiz-question-component-has-correct-li-value.test.js +++ b/src/__tests__/part3/quiz-question-component-has-correct-li-value.test.js @@ -39,14 +39,14 @@ describe('QuizQuestion Component', () => { try { quizQuestion = shallow() } catch (e) { - assert(false, "We weren't able to mount the QuizQuestion component") + assert(false, "We weren't able to mount the QuizQuestion component.") } let html = quizQuestion.html() let div = document.createElement('div') div.innerHTML = html - assert(div.querySelector('main') != null, "no main") + assert(div.querySelector('main') != null, "We can't find a `main` tag in the QuizQuestion component's JSX.") assert(div.querySelectorAll('main section ul li').length != 0, "We can't find an `li` tag inside of the `ul` tag in the QuizQuestion component's JSX.") if (div.querySelectorAll('main section ul li button') != null) { // this runs after @quiz-question-component-displays-quiz-question-button-component diff --git a/src/__tests__/part3/quiz-question-component-has-render-method.test.js b/src/__tests__/part3/quiz-question-component-has-render-method.test.js index bc5699fddf..e78ff37aa2 100644 --- a/src/__tests__/part3/quiz-question-component-has-render-method.test.js +++ b/src/__tests__/part3/quiz-question-component-has-render-method.test.js @@ -27,18 +27,18 @@ describe('QuizQuestion Component', () => { try { quiz = shallow() } catch (e) { - assert(false, "We weren't able to mount the QuizQuestion component") + assert(false, "We weren't able to mount the QuizQuestion component.") } let html = quiz.html() let div = document.createElement('div') div.innerHTML = html - assert(div.querySelector('main') != null, "no main") - assert(div.querySelectorAll('main section') != null, "no main -> section") - assert(div.querySelectorAll('main section').length == 2, "not two sections") + assert(div.querySelector('main') != null, "We can't find a `main` tag in the QuizQuestion component's JSX.") + assert(div.querySelectorAll('main section') != null, "We can't find a `main` tag with a child of `section` in the QuizQuestion component's JSX.") + assert(div.querySelectorAll('main section').length == 2, "We're finding some `section` tags that are children of a `main` tag, but we'd like there to be exactly *2* `section` tags - if you're having trouble, just copy the HTML that we've provided in the task instructions.") // console.log(div.querySelector('main section')) - assert(div.querySelectorAll('main section')[0].querySelector('p'), "no paragraph in first section") - assert(div.querySelectorAll('main section')[1].querySelector('ul'), "no unordered list in first section") + assert(div.querySelectorAll('main section')[0].querySelector('p'), "We can't find a `section` tag with a child of `p` in the QuizQuestion component's JSX.") + assert(div.querySelectorAll('main section')[1].querySelector('ul'), "We can't find a `ul` tag with a child of `li` in the QuizQuestion component's JSX.") }) }) \ No newline at end of file diff --git a/src/__tests__/part3/quiz-question-displays-instruction-text.test.js b/src/__tests__/part3/quiz-question-displays-instruction-text.test.js index bab2f7de7f..6e5a747491 100644 --- a/src/__tests__/part3/quiz-question-displays-instruction-text.test.js +++ b/src/__tests__/part3/quiz-question-displays-instruction-text.test.js @@ -39,15 +39,15 @@ describe('QuizQuestion Component', () => { try { quizQuestion = shallow() } catch (e) { - assert(false, "We weren't able to mount the QuizQuestion component") + assert(false, "We weren't able to mount the QuizQuestion component.") } let html = quizQuestion.html() let div = document.createElement('div') div.innerHTML = html - assert(div.querySelector('main') != null, "no main") - assert(div.querySelectorAll('main section p').length != 0, "We can't find a paragraph tag inside of the first section tag in the QuizQuestion component's JSX.") + assert(div.querySelector('main') != null, "We can't find a `main` tag in the QuizQuestion component's JSX.") + assert(div.querySelectorAll('main section p').length != 0, "We can't find a `p` tag inside of the first `section` tag in the QuizQuestion component's JSX.") let p_contents = div.querySelectorAll('main section p')[0] assert(p_contents.innerHTML == quizData.quiz_questions[0].instruction_text, "You're not displaying the correct data from the `quiz_question` prop in the QuizQuestion component's JSX.") }) diff --git a/src/__tests__/part4/quiz-question-button-component-displays-button-text.test.js b/src/__tests__/part4/quiz-question-button-component-displays-button-text.test.js index 0145004608..b73812feb8 100644 --- a/src/__tests__/part4/quiz-question-button-component-displays-button-text.test.js +++ b/src/__tests__/part4/quiz-question-button-component-displays-button-text.test.js @@ -26,14 +26,14 @@ describe('QuizQuestionButton Component', () => { try { quizQuestionButton = shallow() } catch (e) { - assert(false, "We weren't able to mount the QuizQuestionButton component") + assert(false, "We weren't able to mount the QuizQuestionButton component.") } let html = quizQuestionButton.html() let div = document.createElement('div') div.innerHTML = html - assert(div.querySelector('li button') != null, "no li button") + assert(div.querySelector('li button') != null, "We can't find a `button` tag that's a child of a single `li` tag in the QuizQuestionButton component's JSX.") let button_contents = div.querySelectorAll('li button')[0] assert(button_contents.innerHTML == quizData.quiz_questions[0].answer_options[0], "You're not displaying the correct data from the `button_text` prop in the QuizQuestionButton component's JSX.") }) diff --git a/src/__tests__/part4/quiz-question-button-component-has-render-method.test.js b/src/__tests__/part4/quiz-question-button-component-has-render-method.test.js index 390ee182c0..4b848a1b8d 100644 --- a/src/__tests__/part4/quiz-question-button-component-has-render-method.test.js +++ b/src/__tests__/part4/quiz-question-button-component-has-render-method.test.js @@ -25,15 +25,15 @@ describe('QuizQuestionButton Component', () => { try { quizQuestionButton = shallow() } catch (e) { - assert(false, "We weren't able to mount the QuizQuestionButton component") + assert(false, "We weren't able to mount the QuizQuestionButton component.") } let html = quizQuestionButton.html() let div = document.createElement('div') div.innerHTML = html - assert(div.querySelector('li') != null, "no li") - assert(div.querySelectorAll('li button') != null, "no li -> button") - assert(div.querySelectorAll('li button').length == 1, "not a single button") + assert(div.querySelector('li') != null, "We can't find an `li` tag in the QuizQuestionButton component's JSX.") + assert(div.querySelectorAll('li button') != null, "We can't find a `button` tag that's a child of an `li` tag in the QuizQuestionButton component's JSX.") + assert(div.querySelectorAll('li button').length == 1, "We found more than one `button` tag that's a child of an `li` tag in the QuizQuestionButton component's JSX, but we'd like for there to be exactly one.") }) }) \ No newline at end of file diff --git a/src/__tests__/part4/quiz-question-component-displays-quiz-question-button-component.test.js b/src/__tests__/part4/quiz-question-component-displays-quiz-question-button-component.test.js index f2c214758b..f2cc7e9443 100644 --- a/src/__tests__/part4/quiz-question-component-displays-quiz-question-button-component.test.js +++ b/src/__tests__/part4/quiz-question-component-displays-quiz-question-button-component.test.js @@ -38,15 +38,15 @@ describe('QuizQuestion Component', () => { try { quizQuestion = shallow() } catch (e) { - assert(false, "We weren't able to mount the QuizQuestion component") + assert(false, "We weren't able to mount the QuizQuestion component.") } let html = quizQuestion.html() let div = document.createElement('div') div.innerHTML = html - assert(div.querySelector('main') != null, "no main") + assert(div.querySelector('main') != null, "We can't find a `main` tag in the QuizQuestion component's JSX.") let ul_contents = div.querySelectorAll('main section ul')[0] - assert(ul_contents.querySelector('li button') != null, "You're not rendering the correct HTML tags from the QuizQuestionButton component in the QuizQuestion's render method") + assert(ul_contents.querySelector('li button') != null, "You're not rendering the correct HTML tags from the QuizQuestionButton component in the QuizQuestion's render method.") }) }) \ No newline at end of file diff --git a/src/__tests__/part5/quiz-end-component-has-render-method.test.js b/src/__tests__/part5/quiz-end-component-has-render-method.test.js index f42e8c5764..0a9caadf8b 100644 --- a/src/__tests__/part5/quiz-end-component-has-render-method.test.js +++ b/src/__tests__/part5/quiz-end-component-has-render-method.test.js @@ -23,18 +23,18 @@ describe('QuizEnd Component', () => { try { quizEnd = shallow() } catch (e) { - assert(false, "We weren't able to mount the QuizEnd component") + assert(false, "We weren't able to mount the QuizEnd component.") } let html = quizEnd.html() let div = document.createElement('div') div.innerHTML = html - assert(div.querySelector('div') != null, "no div") - assert(div.querySelector('div p') != null, "no div -> p") - assert(div.querySelector('div a') != null, "no div -> a") - assert(div.querySelector('div p').innerHTML == "Thanks for playing!", "incorrect p text") - assert(div.querySelector('div a').innerHTML == "Reset Quiz", "incorrect a text") - assert(div.querySelector('div a').getAttribute('href') == '', "incorrect href") + assert(div.querySelector('div') != null, "We can't find a `div` tag in the QuizEnd component's JSX.") + assert(div.querySelector('div p') != null, "We can't find a `p` tag that's a child of a `div` tag in the QuizEnd component's JSX.") + assert(div.querySelector('div a') != null, "We can't find an `a` tag that's a child of a `div` tag in the QuizEnd component's JSX.") + assert(div.querySelector('div p').innerHTML == "Thanks for playing!", "We found a paragraph tag in the QuizEnd component's JSX, but it has the incorrect text value.") + assert(div.querySelector('div a').innerHTML == "Reset Quiz", "We found an anchor tag in the QuizEnd component's JSX, but it has the incorrect text value.") + assert(div.querySelector('div a').getAttribute('href') == '', "We found a anchor tag in the QuizEnd component's JSX, but it has the incorrect value for the `href` attribute.") }) }) \ No newline at end of file From eede99f7919458b832d542ffcf2a179acd6c25e8 Mon Sep 17 00:00:00 2001 From: Jon Friskics Date: Sat, 5 May 2018 13:31:06 -0400 Subject: [PATCH 08/23] fix punctuation in failure messages --- .../part2/quiz-component-constructor-sets-state.test.js | 2 +- .../quiz-component-displays-instruction-text.test.js | 2 +- src/__tests__/part2/quiz-component-has-quiz-class.test.js | 2 +- .../part2/quiz-component-has-render-method.test.js | 4 ++-- src/__tests__/part2/quiz-component-imports-react.test.js | 4 ++-- .../part2/quiz-component-requires-quiz-json.test.js | 2 +- ...uiz-component-displays-quiz-question-component.test.js | 4 ++-- ...uiz-question-component-has-quiz-question-class.test.js | 2 +- ...quiz-question-component-has-quiz-question-prop.test.js | 4 ++-- .../part3/quiz-question-component-imports-react.test.js | 4 ++-- ...question-button-component-has-button-text-prop.test.js | 2 +- ...utton-component-has-quiz-question-button-class.test.js | 2 +- .../quiz-question-button-component-imports-react.test.js | 4 ++-- .../quiz-component-displays-quiz-end-component.test.js | 4 ++-- .../part5/quiz-component-has-conditional.test.js | 6 +++--- .../part5/quiz-component-has-is-quiz-end-const.test.js | 4 ++-- .../part5/quiz-end-component-has-quiz-end-class.test.js | 2 +- .../part5/quiz-end-component-imports-react.test.js | 4 ++-- .../part6/quiz-has-next-question-handler.test.js | 2 +- ...tton-handle-click-method-returns-correct-value.test.js | 4 ++-- .../quiz-question-button-has-onclick-handler.test.js | 4 ++-- ...tion-component-maps-multiple-button-components.test.js | 2 +- ...tion-handle-click-method-returns-correct-value.test.js | 4 ++-- .../part6/quiz-question-has-onclick-handler.test.js | 8 ++++---- ...z-show-next-question-increments-position-state.test.js | 2 +- .../quiz-question-component-sets-correct-state.test.js | 2 +- .../quiz-end-component-anchor-has-onclick-handler.test.js | 2 +- ...-end-handle-click-method-returns-correct-value.test.js | 4 ++-- .../part8/quiz-end-has-reset-click-handler.test.js | 2 +- .../quiz-handle-reset-click-sets-position-state.test.js | 2 +- 30 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/__tests__/part2/quiz-component-constructor-sets-state.test.js b/src/__tests__/part2/quiz-component-constructor-sets-state.test.js index f15043246b..f407d566e9 100644 --- a/src/__tests__/part2/quiz-component-constructor-sets-state.test.js +++ b/src/__tests__/part2/quiz-component-constructor-sets-state.test.js @@ -23,7 +23,7 @@ describe('Quiz Component', () => { try { quiz = shallow() } catch (e) { - assert(false, "We weren't able to mount the Quiz component") + assert(false, "We weren't able to mount the Quiz component.") } let expectedState = { diff --git a/src/__tests__/part2/quiz-component-displays-instruction-text.test.js b/src/__tests__/part2/quiz-component-displays-instruction-text.test.js index 1887903f0b..f9368648c6 100644 --- a/src/__tests__/part2/quiz-component-displays-instruction-text.test.js +++ b/src/__tests__/part2/quiz-component-displays-instruction-text.test.js @@ -24,7 +24,7 @@ describe('Quiz Component', () => { try { quiz = shallow() } catch (e) { - assert(false, "We weren't able to mount the Quiz component") + assert(false, "We weren't able to mount the Quiz component.") } if (quiz.find('.QuizQuestion').length > 0) { diff --git a/src/__tests__/part2/quiz-component-has-quiz-class.test.js b/src/__tests__/part2/quiz-component-has-quiz-class.test.js index 1730da0ea1..a1ce028a84 100644 --- a/src/__tests__/part2/quiz-component-has-quiz-class.test.js +++ b/src/__tests__/part2/quiz-component-has-quiz-class.test.js @@ -47,6 +47,6 @@ describe('Quiz Component', () => { let re = /\nexport default Quiz\;*\s*$/g let match = file.match(re) - assert(match != null && match.length > 0, "We couldn't find `export default Quiz` at the end of your Quiz.js file") + assert(match != null && match.length > 0, "We couldn't find `export default Quiz` at the end of your Quiz.js file.") }) }) \ No newline at end of file diff --git a/src/__tests__/part2/quiz-component-has-render-method.test.js b/src/__tests__/part2/quiz-component-has-render-method.test.js index caaa011ec9..01004e1a17 100644 --- a/src/__tests__/part2/quiz-component-has-render-method.test.js +++ b/src/__tests__/part2/quiz-component-has-render-method.test.js @@ -24,7 +24,7 @@ describe('Quiz Component', () => { try { quiz = shallow() } catch (e) { - assert(false, "We weren't able to mount the Quiz component") + assert(false, "We weren't able to mount the Quiz component.") } if (quiz.containsMatchingElement(
)) { @@ -40,7 +40,7 @@ describe('Quiz Component', () => { // this block will run after @quiz-component-displays-quiz-question-component } else { // this block will run until @quiz-component-has-quiz-question-div - assert(quiz.containsMatchingElement(
Quiz
), "The Quiz component isn't rendering a single div with the text `Quiz`") + assert(quiz.containsMatchingElement(
Quiz
), "The Quiz component isn't rendering a single div with the text `Quiz`.") } }) }) \ No newline at end of file diff --git a/src/__tests__/part2/quiz-component-imports-react.test.js b/src/__tests__/part2/quiz-component-imports-react.test.js index 211dca460b..ddb710ce7a 100644 --- a/src/__tests__/part2/quiz-component-imports-react.test.js +++ b/src/__tests__/part2/quiz-component-imports-react.test.js @@ -32,7 +32,7 @@ describe('Quiz Component', () => { }) } }) - assert(react_class_import_found, "You're not importing the React class") - assert(component_class_import_found, "You're not importing the Component class") + assert(react_class_import_found, "You're not importing the React class.") + assert(component_class_import_found, "You're not importing the Component class.") }); }) \ No newline at end of file diff --git a/src/__tests__/part2/quiz-component-requires-quiz-json.test.js b/src/__tests__/part2/quiz-component-requires-quiz-json.test.js index d8b9941d57..003cf3e201 100644 --- a/src/__tests__/part2/quiz-component-requires-quiz-json.test.js +++ b/src/__tests__/part2/quiz-component-requires-quiz-json.test.js @@ -17,7 +17,7 @@ describe('Quiz Component', () => { } let ast = babylon.parse(file, { sourceType: "module", plugins: ["jsx"] }) - assert(ast.program.body, "We can't find any code in the Quiz.js file") + assert(ast.program.body, "We can't find any code in the Quiz.js file.") let quiz_data_loaded_correctly = false; diff --git a/src/__tests__/part3/quiz-component-displays-quiz-question-component.test.js b/src/__tests__/part3/quiz-component-displays-quiz-question-component.test.js index 6a70db203b..688be84819 100644 --- a/src/__tests__/part3/quiz-component-displays-quiz-question-component.test.js +++ b/src/__tests__/part3/quiz-component-displays-quiz-question-component.test.js @@ -33,9 +33,9 @@ describe('Quiz Component', () => { try { quiz = shallow() } catch (e) { - assert(false, "We weren't able to mount the Quiz component") + assert(false, "We weren't able to mount the Quiz component.") } - assert(quiz.find('QuizQuestion').length == 1, "We couldn't find the QuizQuestion component being loaded by the Quiz component") + assert(quiz.find('QuizQuestion').length == 1, "We couldn't find the QuizQuestion component being loaded by the Quiz component.") }) }) \ No newline at end of file diff --git a/src/__tests__/part3/quiz-question-component-has-quiz-question-class.test.js b/src/__tests__/part3/quiz-question-component-has-quiz-question-class.test.js index 7bc850986f..6c583a506e 100644 --- a/src/__tests__/part3/quiz-question-component-has-quiz-question-class.test.js +++ b/src/__tests__/part3/quiz-question-component-has-quiz-question-class.test.js @@ -47,6 +47,6 @@ describe('QuizQuestion Component', () => { let re = /\nexport default QuizQuestion\;*\s*$/g let match = file.match(re) - assert(match != null && match.length > 0, "We couldn't find `export default QuizQuestion` at the end of your QuizQuestion.js file") + assert(match != null && match.length > 0, "We couldn't find `export default QuizQuestion` at the end of your QuizQuestion.js file.") }) }) \ No newline at end of file diff --git a/src/__tests__/part3/quiz-question-component-has-quiz-question-prop.test.js b/src/__tests__/part3/quiz-question-component-has-quiz-question-prop.test.js index e26f2d868c..4bd52a904f 100644 --- a/src/__tests__/part3/quiz-question-component-has-quiz-question-prop.test.js +++ b/src/__tests__/part3/quiz-question-component-has-quiz-question-prop.test.js @@ -34,10 +34,10 @@ describe('Quiz Component', () => { try { quiz = shallow() } catch (e) { - assert(false, "We weren't able to mount the Quiz component") + assert(false, "We weren't able to mount the Quiz component.") } - assert(quiz.find('QuizQuestion').length == 1, "We couldn't find the QuizQuestion component being loaded by the Quiz component") + assert(quiz.find('QuizQuestion').length == 1, "We couldn't find the QuizQuestion component being loaded by the Quiz component.") assert(quiz.find('QuizQuestion').props().quiz_question != null, "The QuizQuestion component exists, but there's no prop named `quiz_question`.") assert(quiz.find('QuizQuestion').props().quiz_question == quizData.quiz_questions[0], "The QuizQuestion component has a prop named `quiz_question`, but it doesn't contain the correct value.") }) diff --git a/src/__tests__/part3/quiz-question-component-imports-react.test.js b/src/__tests__/part3/quiz-question-component-imports-react.test.js index 5cb8b33e9f..5a21ccd303 100644 --- a/src/__tests__/part3/quiz-question-component-imports-react.test.js +++ b/src/__tests__/part3/quiz-question-component-imports-react.test.js @@ -32,8 +32,8 @@ describe('QuizQuestion Component', () => { }) } }) - assert(react_class_import_found, "You're not importing the React class") - assert(component_class_import_found, "You're not importing the Component class") + assert(react_class_import_found, "You're not importing the React class.") + assert(component_class_import_found, "You're not importing the Component class.") }); }) \ No newline at end of file diff --git a/src/__tests__/part4/quiz-question-button-component-has-button-text-prop.test.js b/src/__tests__/part4/quiz-question-button-component-has-button-text-prop.test.js index 8f1e246d6e..e7ec5b70bc 100644 --- a/src/__tests__/part4/quiz-question-button-component-has-button-text-prop.test.js +++ b/src/__tests__/part4/quiz-question-button-component-has-button-text-prop.test.js @@ -39,7 +39,7 @@ describe('QuizQuestion Component', () => { try { quizQuestion = shallow() } catch (e) { - assert(false, "We weren't able to mount the QuizQuestion component") + assert(false, "We weren't able to mount the QuizQuestion component.") } let expectedProps = { diff --git a/src/__tests__/part4/quiz-question-button-component-has-quiz-question-button-class.test.js b/src/__tests__/part4/quiz-question-button-component-has-quiz-question-button-class.test.js index 36acbda305..4183610c7d 100644 --- a/src/__tests__/part4/quiz-question-button-component-has-quiz-question-button-class.test.js +++ b/src/__tests__/part4/quiz-question-button-component-has-quiz-question-button-class.test.js @@ -47,6 +47,6 @@ describe('QuizQuestionButton Component', () => { let re = /\nexport default QuizQuestionButton\;*\s*$/g let match = file.match(re) - assert(match != null && match.length > 0, "We couldn't find `export default QuizQuestionButton` at the end of your QuizQuestionButton.js file") + assert(match != null && match.length > 0, "We couldn't find `export default QuizQuestionButton` at the end of your QuizQuestionButton.js file.") }) }) \ No newline at end of file diff --git a/src/__tests__/part4/quiz-question-button-component-imports-react.test.js b/src/__tests__/part4/quiz-question-button-component-imports-react.test.js index 692cad0e05..2e576dd128 100644 --- a/src/__tests__/part4/quiz-question-button-component-imports-react.test.js +++ b/src/__tests__/part4/quiz-question-button-component-imports-react.test.js @@ -32,8 +32,8 @@ describe('QuizQuestionButton Component', () => { }) } }) - assert(react_class_import_found, "You're not importing the React class") - assert(component_class_import_found, "You're not importing the Component class") + assert(react_class_import_found, "You're not importing the React class.") + assert(component_class_import_found, "You're not importing the Component class.") }); }) \ No newline at end of file diff --git a/src/__tests__/part5/quiz-component-displays-quiz-end-component.test.js b/src/__tests__/part5/quiz-component-displays-quiz-end-component.test.js index c6575d2c21..4e2525270c 100644 --- a/src/__tests__/part5/quiz-component-displays-quiz-end-component.test.js +++ b/src/__tests__/part5/quiz-component-displays-quiz-end-component.test.js @@ -35,13 +35,13 @@ describe('Quiz Component', () => { try { quiz = shallow() } catch (e) { - assert(false, "We weren't able to mount the Quiz component") + assert(false, "We weren't able to mount the Quiz component.") } if (yallReadyForThis()) { // we good } else { - assert(quiz.find('QuizEnd').length == 1, "We couldn't find the QuizEnd component being loaded by the Quiz component") + assert(quiz.find('QuizEnd').length == 1, "We couldn't find the QuizEnd component being loaded by the Quiz component.") } }) }) diff --git a/src/__tests__/part5/quiz-component-has-conditional.test.js b/src/__tests__/part5/quiz-component-has-conditional.test.js index 3ebc0b4e10..234ada33ad 100644 --- a/src/__tests__/part5/quiz-component-has-conditional.test.js +++ b/src/__tests__/part5/quiz-component-has-conditional.test.js @@ -26,13 +26,13 @@ describe('Quiz Component', () => { try { quiz = shallow() } catch (e) { - assert(false, "We weren't able to mount the Quiz component") + assert(false, "We weren't able to mount the Quiz component.") } if (yallReadyForThis()) { - assert(quiz.find('QuizQuestion').length == 1 && quiz.find('QuizEnd').length == 0, "QuizQuestion should be displaying when isQuizEnd is false") + assert(quiz.find('QuizQuestion').length == 1 && quiz.find('QuizEnd').length == 0, "QuizQuestion should be displaying when isQuizEnd is false.") quiz.setState({quiz_position: quizData.quiz_questions.length+1 }) - assert(quiz.find('QuizQuestion').length == 0 && quiz.find('QuizEnd').length == 1, "QuizEnd should be displaying when isQuizEnd is true") + assert(quiz.find('QuizQuestion').length == 0 && quiz.find('QuizEnd').length == 1, "QuizEnd should be displaying when isQuizEnd is true.") } else { assert(false, "We couldn't find a const named `isQuizEnd`.") } diff --git a/src/__tests__/part5/quiz-component-has-is-quiz-end-const.test.js b/src/__tests__/part5/quiz-component-has-is-quiz-end-const.test.js index ad3d4fe6d5..e741617a53 100644 --- a/src/__tests__/part5/quiz-component-has-is-quiz-end-const.test.js +++ b/src/__tests__/part5/quiz-component-has-is-quiz-end-const.test.js @@ -38,8 +38,8 @@ describe('Quiz Component', () => { let statement = file.substring(el3.init.start-20, el3.init.end) let re = /isQuizEnd\s*=\s*\(?\s*\(?\s*this\.state\.quiz_position\s*-\s*1\s*\)?\s*===?\s*quizData\.quiz_questions\.length\)?/g let match = statement.match(re) - assert(match != null, "We can't find where you're writing an expression that checks if `this.state.quiz_position - 1` is equivalent to `quizData.quiz_questions.length`") - assert(match.length == 1, "We can't find where you're writing an expression that checks if `this.state.quiz_position - 1` is equivalent to `quizData.quiz_questions.length`") + assert(match != null, "We can't find where you're writing an expression that checks if `this.state.quiz_position - 1` is equivalent to `quizData.quiz_questions.length`.") + assert(match.length == 1, "We can't find where you're writing an expression that checks if `this.state.quiz_position - 1` is equivalent to `quizData.quiz_questions.length`.") } } }) diff --git a/src/__tests__/part5/quiz-end-component-has-quiz-end-class.test.js b/src/__tests__/part5/quiz-end-component-has-quiz-end-class.test.js index 732626e981..5260f2e497 100644 --- a/src/__tests__/part5/quiz-end-component-has-quiz-end-class.test.js +++ b/src/__tests__/part5/quiz-end-component-has-quiz-end-class.test.js @@ -47,6 +47,6 @@ describe('QuizEnd Component', () => { let re = /\nexport default QuizEnd\;*\s*$/g let match = file.match(re) - assert(match != null && match.length > 0, "We couldn't find `export default QuizEnd` at the end of your QuizEnd.js file") + assert(match != null && match.length > 0, "We couldn't find `export default QuizEnd` at the end of your QuizEnd.js file.") }) }) \ No newline at end of file diff --git a/src/__tests__/part5/quiz-end-component-imports-react.test.js b/src/__tests__/part5/quiz-end-component-imports-react.test.js index ed7105e329..b03242186f 100644 --- a/src/__tests__/part5/quiz-end-component-imports-react.test.js +++ b/src/__tests__/part5/quiz-end-component-imports-react.test.js @@ -32,8 +32,8 @@ describe('QuizEnd Component', () => { }) } }) - assert(react_class_import_found, "You're not importing the React class") - assert(component_class_import_found, "You're not importing the Component class") + assert(react_class_import_found, "You're not importing the React class.") + assert(component_class_import_found, "You're not importing the Component class.") }); }) \ No newline at end of file diff --git a/src/__tests__/part6/quiz-has-next-question-handler.test.js b/src/__tests__/part6/quiz-has-next-question-handler.test.js index 3446ec0683..236ca0166a 100644 --- a/src/__tests__/part6/quiz-has-next-question-handler.test.js +++ b/src/__tests__/part6/quiz-has-next-question-handler.test.js @@ -26,7 +26,7 @@ describe('Quiz Component', () => { try { quiz = shallow() } catch (e) { - assert(false, "We weren't able to mount the Quiz component") + assert(false, "We weren't able to mount the Quiz component.") } assert(quiz.find('QuizQuestion').length == 1, "We couldn't find the QuizQuestion component in the Quiz component's JSX.") diff --git a/src/__tests__/part6/quiz-question-button-handle-click-method-returns-correct-value.test.js b/src/__tests__/part6/quiz-question-button-handle-click-method-returns-correct-value.test.js index 6a2f5180b1..b6b45af9b7 100644 --- a/src/__tests__/part6/quiz-question-button-handle-click-method-returns-correct-value.test.js +++ b/src/__tests__/part6/quiz-question-button-handle-click-method-returns-correct-value.test.js @@ -31,11 +31,11 @@ describe('QuizQuestionButton Component', () => { try { quizQuestionButton = shallow() } catch (e) { - assert(false, "We weren't able to mount the QuizQuestionButton component") + assert(false, "We weren't able to mount the QuizQuestionButton component.") } quizQuestionButton.find('button').simulate('click') - assert(spy.calledOnce, "There's not a method named `handleClick()` that's being called on button click in the QuizQuestionButton class") + assert(spy.calledOnce, "There's not a method named `handleClick()` that's being called on button click in the QuizQuestionButton class.") assert(mockedPropHandler.calledOnce, "`this.props.clickHandler()` is not being called from the QuizQuestionButton component's `handleClick()` method.") assert(mockedPropHandler.args[0][0] != null && mockedPropHandler.args[0][0] == '5', "The correct `button_text` prop value was not passed to the `clickHandler` callback in QuizQuestionButton.") }) diff --git a/src/__tests__/part6/quiz-question-button-has-onclick-handler.test.js b/src/__tests__/part6/quiz-question-button-has-onclick-handler.test.js index d81b87bfa0..966144a3e1 100644 --- a/src/__tests__/part6/quiz-question-button-has-onclick-handler.test.js +++ b/src/__tests__/part6/quiz-question-button-has-onclick-handler.test.js @@ -31,11 +31,11 @@ describe('QuizQuestionButton Component', () => { try { quizQuestionButton = shallow() } catch (e) { - assert(false, "We weren't able to mount the QuizQuestionButton component") + assert(false, "We weren't able to mount the QuizQuestionButton component.") } quizQuestionButton.find('button').simulate('click') - assert(spy.calledOnce, "There's not a method named `handleClick()` that's being called on button click in the QuizQuestionButton class") + assert(spy.calledOnce, "There's not a method named `handleClick()` that's being called on button click in the QuizQuestionButton class.") }) }) \ No newline at end of file diff --git a/src/__tests__/part6/quiz-question-component-maps-multiple-button-components.test.js b/src/__tests__/part6/quiz-question-component-maps-multiple-button-components.test.js index f0cd806b99..caeff6aeab 100644 --- a/src/__tests__/part6/quiz-question-component-maps-multiple-button-components.test.js +++ b/src/__tests__/part6/quiz-question-component-maps-multiple-button-components.test.js @@ -29,7 +29,7 @@ describe('QuizQuestion Component', () => { try { quizQuestion = shallow() } catch (e) { - assert(false, "We weren't able to mount the QuizQuestion component") + assert(false, "We weren't able to mount the QuizQuestion component.") } let nodes = quizQuestion.find('QuizQuestionButton') diff --git a/src/__tests__/part6/quiz-question-handle-click-method-returns-correct-value.test.js b/src/__tests__/part6/quiz-question-handle-click-method-returns-correct-value.test.js index 848ebea69d..9f511cbd1a 100644 --- a/src/__tests__/part6/quiz-question-handle-click-method-returns-correct-value.test.js +++ b/src/__tests__/part6/quiz-question-handle-click-method-returns-correct-value.test.js @@ -43,7 +43,7 @@ describe('QuizQuestion Component', () => { quiz = shallow() } catch (e) { console.log(e) - assert(false, "We weren't able to mount the Quiz component") + assert(false, "We weren't able to mount the Quiz component.") } let spy @@ -72,7 +72,7 @@ describe('QuizQuestion Component', () => { try { quizQuestion = shallow() } catch (e) { - assert(false, "We weren't able to mount the QuizQuestion component") + assert(false, "We weren't able to mount the QuizQuestion component.") } quizQuestion.instance().handleClick('3') diff --git a/src/__tests__/part6/quiz-question-has-onclick-handler.test.js b/src/__tests__/part6/quiz-question-has-onclick-handler.test.js index 4befaaacc3..83a2629359 100644 --- a/src/__tests__/part6/quiz-question-has-onclick-handler.test.js +++ b/src/__tests__/part6/quiz-question-has-onclick-handler.test.js @@ -32,14 +32,14 @@ describe('QuizQuestion Component', () => { try { quizQuestion = shallow() } catch (e) { - assert(false, "We weren't able to mount the QuizQuestion component") + assert(false, "We weren't able to mount the QuizQuestion component.") } - assert(quizQuestion.find('QuizQuestionButton').length == quizData.quiz_questions[0].answer_options.length, "The number of QuizQuestionButton components that are rendered by the QuizQuestion component don't match the number of `answer_options` in the JSON data") + assert(quizQuestion.find('QuizQuestionButton').length == quizData.quiz_questions[0].answer_options.length, "The number of QuizQuestionButton components that are rendered by the QuizQuestion component don't match the number of `answer_options` in the JSON data.") - assert(quizQuestion.find('QuizQuestionButton').first().props().clickHandler != null, "The QuizQuestionButton tag in QuizQuestion's JSX doesn't have a `clickHandler` property") + assert(quizQuestion.find('QuizQuestionButton').first().props().clickHandler != null, "The QuizQuestionButton tag in QuizQuestion's JSX doesn't have a `clickHandler` property.") - assert(quizQuestion.find('QuizQuestionButton').first().props().clickHandler.name == 'bound handleClick', "The QuizQuestionButton tag in QuizQuestion's JSX has a `clickHandler` property, but the value isn't set to `this.handleClick.bind(this)`") + assert(quizQuestion.find('QuizQuestionButton').first().props().clickHandler.name == 'bound handleClick', "The QuizQuestionButton tag in QuizQuestion's JSX has a `clickHandler` property, but the value isn't set to `this.handleClick.bind(this)`.") }) }) \ No newline at end of file diff --git a/src/__tests__/part6/quiz-show-next-question-increments-position-state.test.js b/src/__tests__/part6/quiz-show-next-question-increments-position-state.test.js index 7b1bd7ab03..bf4c98d571 100644 --- a/src/__tests__/part6/quiz-show-next-question-increments-position-state.test.js +++ b/src/__tests__/part6/quiz-show-next-question-increments-position-state.test.js @@ -27,7 +27,7 @@ describe('Quiz Component', () => { try { quiz = shallow() } catch (e) { - assert(false, "We weren't able to mount the Quiz component") + assert(false, "We weren't able to mount the Quiz component.") } if (quiz.state().quiz_position) { diff --git a/src/__tests__/part7/quiz-question-component-sets-correct-state.test.js b/src/__tests__/part7/quiz-question-component-sets-correct-state.test.js index 23377048ae..04ae063389 100644 --- a/src/__tests__/part7/quiz-question-component-sets-correct-state.test.js +++ b/src/__tests__/part7/quiz-question-component-sets-correct-state.test.js @@ -64,7 +64,7 @@ describe('QuizQuestion Component', () => { try { quizQuestion = shallow() } catch (e) { - assert(false, "We weren't able to mount the QuizQuestion component") + assert(false, "We weren't able to mount the QuizQuestion component.") } let expectedStateBefore = { diff --git a/src/__tests__/part8/quiz-end-component-anchor-has-onclick-handler.test.js b/src/__tests__/part8/quiz-end-component-anchor-has-onclick-handler.test.js index 4fd91c38aa..310a6718a3 100644 --- a/src/__tests__/part8/quiz-end-component-anchor-has-onclick-handler.test.js +++ b/src/__tests__/part8/quiz-end-component-anchor-has-onclick-handler.test.js @@ -31,7 +31,7 @@ describe('QuizEnd Component', () => { try { quizEnd = shallow() } catch (e) { - assert(false, "We weren't able to mount the QuizEnd component") + assert(false, "We weren't able to mount the QuizEnd component.") } quizEnd.find('a').simulate('click') diff --git a/src/__tests__/part8/quiz-end-handle-click-method-returns-correct-value.test.js b/src/__tests__/part8/quiz-end-handle-click-method-returns-correct-value.test.js index e8adfbcb7b..fac2009d7c 100644 --- a/src/__tests__/part8/quiz-end-handle-click-method-returns-correct-value.test.js +++ b/src/__tests__/part8/quiz-end-handle-click-method-returns-correct-value.test.js @@ -33,7 +33,7 @@ describe('QuizEnd Component', () => { quiz = shallow() } catch (e) { console.log(e) - assert(false, "We weren't able to mount the Quiz component") + assert(false, "We weren't able to mount the Quiz component.") } let quiz_spy @@ -62,7 +62,7 @@ describe('QuizEnd Component', () => { try { quizEnd = shallow() } catch (e) { - assert(false, "We weren't able to mount the QuizEnd component") + assert(false, "We weren't able to mount the QuizEnd component.") } quizEnd.find('a').simulate('click') diff --git a/src/__tests__/part8/quiz-end-has-reset-click-handler.test.js b/src/__tests__/part8/quiz-end-has-reset-click-handler.test.js index 1157906eba..36666ad8a5 100644 --- a/src/__tests__/part8/quiz-end-has-reset-click-handler.test.js +++ b/src/__tests__/part8/quiz-end-has-reset-click-handler.test.js @@ -37,7 +37,7 @@ describe('QuizEnd Component', () => { try { quiz = shallow() } catch (e) { - assert(false, "We weren't able to mount the Quiz component") + assert(false, "We weren't able to mount the Quiz component.") } quiz.setState({ quiz_position: quizData.quiz_questions.length + 1 }) diff --git a/src/__tests__/part8/quiz-handle-reset-click-sets-position-state.test.js b/src/__tests__/part8/quiz-handle-reset-click-sets-position-state.test.js index 1d29a91f57..8f982f6a6a 100644 --- a/src/__tests__/part8/quiz-handle-reset-click-sets-position-state.test.js +++ b/src/__tests__/part8/quiz-handle-reset-click-sets-position-state.test.js @@ -26,7 +26,7 @@ describe('Quiz Component', () => { try { quiz = shallow() } catch (e) { - assert(false, "We weren't able to mount the Quiz component") + assert(false, "We weren't able to mount the Quiz component.") } quiz.setState({ quiz_position: 3 }) From fadb4975ee1ce589d0e4efb0e3bbc7b82d3c2707 Mon Sep 17 00:00:00 2001 From: thatchej Date: Wed, 16 May 2018 12:48:24 -0700 Subject: [PATCH 09/23] chore(nvmrc): add .nvmrc @ 9.9.0 to project --- .nvmrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000000..5ffe92dddc --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +9.9.0 From 9473f887c602282afd09d5c04a86ca982b7596d6 Mon Sep 17 00:00:00 2001 From: Jon Friskics Date: Fri, 25 May 2018 00:11:10 -0400 Subject: [PATCH 10/23] change test commands to read from module directory instead of part directory --- package.json | 25 ++++++------------- ...-component-displays-quiz-component.test.js | 0 .../app-component-imports-quiz.test.js | 0 ...z-component-constructor-sets-state.test.js | 0 ...omponent-displays-instruction-text.test.js | 0 .../quiz-component-exists.test.js | 0 ...component-has-constructor-function.test.js | 0 .../quiz-component-has-quiz-class.test.js | 0 ...iz-component-has-quiz-question-div.test.js | 0 .../quiz-component-has-render-method.test.js | 0 .../quiz-component-imports-react.test.js | 0 .../quiz-component-requires-quiz-json.test.js | 0 ...t-displays-quiz-question-component.test.js | 0 ...nt-imports-quiz-question-component.test.js | 0 .../quiz-question-component-exists.test.js | 0 ...ion-component-has-correct-li-value.test.js | 0 ...-component-has-quiz-question-class.test.js | 0 ...n-component-has-quiz-question-prop.test.js | 0 ...estion-component-has-render-method.test.js | 0 ...z-question-component-imports-react.test.js | 0 ...question-displays-instruction-text.test.js | 0 ...ton-component-displays-button-text.test.js | 0 ...z-question-button-component-exists.test.js | 0 ...ton-component-has-button-text-prop.test.js | 0 ...ent-has-quiz-question-button-class.test.js | 0 ...button-component-has-render-method.test.js | 0 ...ion-button-component-imports-react.test.js | 0 ...ays-quiz-question-button-component.test.js | 0 ...rts-quiz-question-button-component.test.js | 0 ...ponent-displays-quiz-end-component.test.js | 0 .../quiz-component-has-conditional.test.js | 0 ...iz-component-has-is-quiz-end-const.test.js | 0 ...mponent-imports-quiz-end-component.test.js | 0 .../quiz-end-component-exists.test.js | 0 ...z-end-component-has-quiz-end-class.test.js | 0 ...iz-end-component-has-render-method.test.js | 0 .../quiz-end-component-imports-react.test.js | 0 .../quiz-has-next-question-handler.test.js | 0 ...tton-components-have-correct-props.test.js | 0 ...click-method-returns-correct-value.test.js | 0 ...uestion-button-has-onclick-handler.test.js | 0 ...nt-maps-multiple-button-components.test.js | 0 ...click-method-returns-correct-value.test.js | 0 .../quiz-question-has-onclick-handler.test.js | 0 ...question-increments-position-state.test.js | 0 ...n-component-constructor-sets-state.test.js | 0 ...component-has-constructor-function.test.js | 0 ...stion-component-sets-correct-state.test.js | 0 ...question-component-shows-error-tag.test.js | 0 ...mponent-anchor-has-onclick-handler.test.js | 0 ...click-method-returns-correct-value.test.js | 0 .../quiz-end-has-reset-click-handler.test.js | 0 ...le-reset-click-sets-position-state.test.js | 0 53 files changed, 8 insertions(+), 17 deletions(-) rename src/__tests__/{part2 => module1}/app-component-displays-quiz-component.test.js (100%) rename src/__tests__/{part2 => module1}/app-component-imports-quiz.test.js (100%) rename src/__tests__/{part2 => module1}/quiz-component-constructor-sets-state.test.js (100%) rename src/__tests__/{part2 => module1}/quiz-component-displays-instruction-text.test.js (100%) rename src/__tests__/{part2 => module1}/quiz-component-exists.test.js (100%) rename src/__tests__/{part2 => module1}/quiz-component-has-constructor-function.test.js (100%) rename src/__tests__/{part2 => module1}/quiz-component-has-quiz-class.test.js (100%) rename src/__tests__/{part2 => module1}/quiz-component-has-quiz-question-div.test.js (100%) rename src/__tests__/{part2 => module1}/quiz-component-has-render-method.test.js (100%) rename src/__tests__/{part2 => module1}/quiz-component-imports-react.test.js (100%) rename src/__tests__/{part2 => module1}/quiz-component-requires-quiz-json.test.js (100%) rename src/__tests__/{part3 => module2}/quiz-component-displays-quiz-question-component.test.js (100%) rename src/__tests__/{part3 => module2}/quiz-component-imports-quiz-question-component.test.js (100%) rename src/__tests__/{part3 => module2}/quiz-question-component-exists.test.js (100%) rename src/__tests__/{part3 => module2}/quiz-question-component-has-correct-li-value.test.js (100%) rename src/__tests__/{part3 => module2}/quiz-question-component-has-quiz-question-class.test.js (100%) rename src/__tests__/{part3 => module2}/quiz-question-component-has-quiz-question-prop.test.js (100%) rename src/__tests__/{part3 => module2}/quiz-question-component-has-render-method.test.js (100%) rename src/__tests__/{part3 => module2}/quiz-question-component-imports-react.test.js (100%) rename src/__tests__/{part3 => module2}/quiz-question-displays-instruction-text.test.js (100%) rename src/__tests__/{part4 => module3}/quiz-question-button-component-displays-button-text.test.js (100%) rename src/__tests__/{part4 => module3}/quiz-question-button-component-exists.test.js (100%) rename src/__tests__/{part4 => module3}/quiz-question-button-component-has-button-text-prop.test.js (100%) rename src/__tests__/{part4 => module3}/quiz-question-button-component-has-quiz-question-button-class.test.js (100%) rename src/__tests__/{part4 => module3}/quiz-question-button-component-has-render-method.test.js (100%) rename src/__tests__/{part4 => module3}/quiz-question-button-component-imports-react.test.js (100%) rename src/__tests__/{part4 => module3}/quiz-question-component-displays-quiz-question-button-component.test.js (100%) rename src/__tests__/{part4 => module3}/quiz-question-component-imports-quiz-question-button-component.test.js (100%) rename src/__tests__/{part5 => module4}/quiz-component-displays-quiz-end-component.test.js (100%) rename src/__tests__/{part5 => module4}/quiz-component-has-conditional.test.js (100%) rename src/__tests__/{part5 => module4}/quiz-component-has-is-quiz-end-const.test.js (100%) rename src/__tests__/{part5 => module4}/quiz-component-imports-quiz-end-component.test.js (100%) rename src/__tests__/{part5 => module4}/quiz-end-component-exists.test.js (100%) rename src/__tests__/{part5 => module4}/quiz-end-component-has-quiz-end-class.test.js (100%) rename src/__tests__/{part5 => module4}/quiz-end-component-has-render-method.test.js (100%) rename src/__tests__/{part5 => module4}/quiz-end-component-imports-react.test.js (100%) rename src/__tests__/{part6 => module5}/quiz-has-next-question-handler.test.js (100%) rename src/__tests__/{part6 => module5}/quiz-question-button-components-have-correct-props.test.js (100%) rename src/__tests__/{part6 => module5}/quiz-question-button-handle-click-method-returns-correct-value.test.js (100%) rename src/__tests__/{part6 => module5}/quiz-question-button-has-onclick-handler.test.js (100%) rename src/__tests__/{part6 => module5}/quiz-question-component-maps-multiple-button-components.test.js (100%) rename src/__tests__/{part6 => module5}/quiz-question-handle-click-method-returns-correct-value.test.js (100%) rename src/__tests__/{part6 => module5}/quiz-question-has-onclick-handler.test.js (100%) rename src/__tests__/{part6 => module5}/quiz-show-next-question-increments-position-state.test.js (100%) rename src/__tests__/{part7 => module6}/quiz-question-component-constructor-sets-state.test.js (100%) rename src/__tests__/{part7 => module6}/quiz-question-component-has-constructor-function.test.js (100%) rename src/__tests__/{part7 => module6}/quiz-question-component-sets-correct-state.test.js (100%) rename src/__tests__/{part7 => module6}/quiz-question-component-shows-error-tag.test.js (100%) rename src/__tests__/{part8 => module7}/quiz-end-component-anchor-has-onclick-handler.test.js (100%) rename src/__tests__/{part8 => module7}/quiz-end-handle-click-method-returns-correct-value.test.js (100%) rename src/__tests__/{part8 => module7}/quiz-end-has-reset-click-handler.test.js (100%) rename src/__tests__/{part8 => module7}/quiz-handle-reset-click-sets-position-state.test.js (100%) diff --git a/package.json b/package.json index f6461d5fef..49c74187bf 100644 --- a/package.json +++ b/package.json @@ -10,23 +10,14 @@ "scripts": { "start": "react-scripts start", "build": "react-scripts build", - "test": "./node_modules/.bin/cross-env react-scripts test --env=jsdom", - "test:module1": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part2", - "test:module2": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part3", - "test:module3": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part4", - "test:module4": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part5", - "test:module5": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part6", - "test:module6": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part7", - "test:module7": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part8", - "test:part8": "./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/part8", - "tutor-test:module1": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part2", - "tutor-test:module2": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part3", - "tutor-test:module3": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part4", - "tutor-test:module4": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part5", - "tutor-test:module5": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part6", - "tutor-test:module6": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part7", - "tutor-test:module7": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace src/__tests__/part8", - "tutor-test": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --json --noStackTrace", + "test": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom", + "test:module1": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module1", + "test:module2": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module2", + "test:module3": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module3", + "test:module4": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module4", + "test:module5": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module5", + "test:module6": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module6", + "test:module7": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module7", "eject": "react-scripts eject" }, "jest": { diff --git a/src/__tests__/part2/app-component-displays-quiz-component.test.js b/src/__tests__/module1/app-component-displays-quiz-component.test.js similarity index 100% rename from src/__tests__/part2/app-component-displays-quiz-component.test.js rename to src/__tests__/module1/app-component-displays-quiz-component.test.js diff --git a/src/__tests__/part2/app-component-imports-quiz.test.js b/src/__tests__/module1/app-component-imports-quiz.test.js similarity index 100% rename from src/__tests__/part2/app-component-imports-quiz.test.js rename to src/__tests__/module1/app-component-imports-quiz.test.js diff --git a/src/__tests__/part2/quiz-component-constructor-sets-state.test.js b/src/__tests__/module1/quiz-component-constructor-sets-state.test.js similarity index 100% rename from src/__tests__/part2/quiz-component-constructor-sets-state.test.js rename to src/__tests__/module1/quiz-component-constructor-sets-state.test.js diff --git a/src/__tests__/part2/quiz-component-displays-instruction-text.test.js b/src/__tests__/module1/quiz-component-displays-instruction-text.test.js similarity index 100% rename from src/__tests__/part2/quiz-component-displays-instruction-text.test.js rename to src/__tests__/module1/quiz-component-displays-instruction-text.test.js diff --git a/src/__tests__/part2/quiz-component-exists.test.js b/src/__tests__/module1/quiz-component-exists.test.js similarity index 100% rename from src/__tests__/part2/quiz-component-exists.test.js rename to src/__tests__/module1/quiz-component-exists.test.js diff --git a/src/__tests__/part2/quiz-component-has-constructor-function.test.js b/src/__tests__/module1/quiz-component-has-constructor-function.test.js similarity index 100% rename from src/__tests__/part2/quiz-component-has-constructor-function.test.js rename to src/__tests__/module1/quiz-component-has-constructor-function.test.js diff --git a/src/__tests__/part2/quiz-component-has-quiz-class.test.js b/src/__tests__/module1/quiz-component-has-quiz-class.test.js similarity index 100% rename from src/__tests__/part2/quiz-component-has-quiz-class.test.js rename to src/__tests__/module1/quiz-component-has-quiz-class.test.js diff --git a/src/__tests__/part2/quiz-component-has-quiz-question-div.test.js b/src/__tests__/module1/quiz-component-has-quiz-question-div.test.js similarity index 100% rename from src/__tests__/part2/quiz-component-has-quiz-question-div.test.js rename to src/__tests__/module1/quiz-component-has-quiz-question-div.test.js diff --git a/src/__tests__/part2/quiz-component-has-render-method.test.js b/src/__tests__/module1/quiz-component-has-render-method.test.js similarity index 100% rename from src/__tests__/part2/quiz-component-has-render-method.test.js rename to src/__tests__/module1/quiz-component-has-render-method.test.js diff --git a/src/__tests__/part2/quiz-component-imports-react.test.js b/src/__tests__/module1/quiz-component-imports-react.test.js similarity index 100% rename from src/__tests__/part2/quiz-component-imports-react.test.js rename to src/__tests__/module1/quiz-component-imports-react.test.js diff --git a/src/__tests__/part2/quiz-component-requires-quiz-json.test.js b/src/__tests__/module1/quiz-component-requires-quiz-json.test.js similarity index 100% rename from src/__tests__/part2/quiz-component-requires-quiz-json.test.js rename to src/__tests__/module1/quiz-component-requires-quiz-json.test.js diff --git a/src/__tests__/part3/quiz-component-displays-quiz-question-component.test.js b/src/__tests__/module2/quiz-component-displays-quiz-question-component.test.js similarity index 100% rename from src/__tests__/part3/quiz-component-displays-quiz-question-component.test.js rename to src/__tests__/module2/quiz-component-displays-quiz-question-component.test.js diff --git a/src/__tests__/part3/quiz-component-imports-quiz-question-component.test.js b/src/__tests__/module2/quiz-component-imports-quiz-question-component.test.js similarity index 100% rename from src/__tests__/part3/quiz-component-imports-quiz-question-component.test.js rename to src/__tests__/module2/quiz-component-imports-quiz-question-component.test.js diff --git a/src/__tests__/part3/quiz-question-component-exists.test.js b/src/__tests__/module2/quiz-question-component-exists.test.js similarity index 100% rename from src/__tests__/part3/quiz-question-component-exists.test.js rename to src/__tests__/module2/quiz-question-component-exists.test.js diff --git a/src/__tests__/part3/quiz-question-component-has-correct-li-value.test.js b/src/__tests__/module2/quiz-question-component-has-correct-li-value.test.js similarity index 100% rename from src/__tests__/part3/quiz-question-component-has-correct-li-value.test.js rename to src/__tests__/module2/quiz-question-component-has-correct-li-value.test.js diff --git a/src/__tests__/part3/quiz-question-component-has-quiz-question-class.test.js b/src/__tests__/module2/quiz-question-component-has-quiz-question-class.test.js similarity index 100% rename from src/__tests__/part3/quiz-question-component-has-quiz-question-class.test.js rename to src/__tests__/module2/quiz-question-component-has-quiz-question-class.test.js diff --git a/src/__tests__/part3/quiz-question-component-has-quiz-question-prop.test.js b/src/__tests__/module2/quiz-question-component-has-quiz-question-prop.test.js similarity index 100% rename from src/__tests__/part3/quiz-question-component-has-quiz-question-prop.test.js rename to src/__tests__/module2/quiz-question-component-has-quiz-question-prop.test.js diff --git a/src/__tests__/part3/quiz-question-component-has-render-method.test.js b/src/__tests__/module2/quiz-question-component-has-render-method.test.js similarity index 100% rename from src/__tests__/part3/quiz-question-component-has-render-method.test.js rename to src/__tests__/module2/quiz-question-component-has-render-method.test.js diff --git a/src/__tests__/part3/quiz-question-component-imports-react.test.js b/src/__tests__/module2/quiz-question-component-imports-react.test.js similarity index 100% rename from src/__tests__/part3/quiz-question-component-imports-react.test.js rename to src/__tests__/module2/quiz-question-component-imports-react.test.js diff --git a/src/__tests__/part3/quiz-question-displays-instruction-text.test.js b/src/__tests__/module2/quiz-question-displays-instruction-text.test.js similarity index 100% rename from src/__tests__/part3/quiz-question-displays-instruction-text.test.js rename to src/__tests__/module2/quiz-question-displays-instruction-text.test.js diff --git a/src/__tests__/part4/quiz-question-button-component-displays-button-text.test.js b/src/__tests__/module3/quiz-question-button-component-displays-button-text.test.js similarity index 100% rename from src/__tests__/part4/quiz-question-button-component-displays-button-text.test.js rename to src/__tests__/module3/quiz-question-button-component-displays-button-text.test.js diff --git a/src/__tests__/part4/quiz-question-button-component-exists.test.js b/src/__tests__/module3/quiz-question-button-component-exists.test.js similarity index 100% rename from src/__tests__/part4/quiz-question-button-component-exists.test.js rename to src/__tests__/module3/quiz-question-button-component-exists.test.js diff --git a/src/__tests__/part4/quiz-question-button-component-has-button-text-prop.test.js b/src/__tests__/module3/quiz-question-button-component-has-button-text-prop.test.js similarity index 100% rename from src/__tests__/part4/quiz-question-button-component-has-button-text-prop.test.js rename to src/__tests__/module3/quiz-question-button-component-has-button-text-prop.test.js diff --git a/src/__tests__/part4/quiz-question-button-component-has-quiz-question-button-class.test.js b/src/__tests__/module3/quiz-question-button-component-has-quiz-question-button-class.test.js similarity index 100% rename from src/__tests__/part4/quiz-question-button-component-has-quiz-question-button-class.test.js rename to src/__tests__/module3/quiz-question-button-component-has-quiz-question-button-class.test.js diff --git a/src/__tests__/part4/quiz-question-button-component-has-render-method.test.js b/src/__tests__/module3/quiz-question-button-component-has-render-method.test.js similarity index 100% rename from src/__tests__/part4/quiz-question-button-component-has-render-method.test.js rename to src/__tests__/module3/quiz-question-button-component-has-render-method.test.js diff --git a/src/__tests__/part4/quiz-question-button-component-imports-react.test.js b/src/__tests__/module3/quiz-question-button-component-imports-react.test.js similarity index 100% rename from src/__tests__/part4/quiz-question-button-component-imports-react.test.js rename to src/__tests__/module3/quiz-question-button-component-imports-react.test.js diff --git a/src/__tests__/part4/quiz-question-component-displays-quiz-question-button-component.test.js b/src/__tests__/module3/quiz-question-component-displays-quiz-question-button-component.test.js similarity index 100% rename from src/__tests__/part4/quiz-question-component-displays-quiz-question-button-component.test.js rename to src/__tests__/module3/quiz-question-component-displays-quiz-question-button-component.test.js diff --git a/src/__tests__/part4/quiz-question-component-imports-quiz-question-button-component.test.js b/src/__tests__/module3/quiz-question-component-imports-quiz-question-button-component.test.js similarity index 100% rename from src/__tests__/part4/quiz-question-component-imports-quiz-question-button-component.test.js rename to src/__tests__/module3/quiz-question-component-imports-quiz-question-button-component.test.js diff --git a/src/__tests__/part5/quiz-component-displays-quiz-end-component.test.js b/src/__tests__/module4/quiz-component-displays-quiz-end-component.test.js similarity index 100% rename from src/__tests__/part5/quiz-component-displays-quiz-end-component.test.js rename to src/__tests__/module4/quiz-component-displays-quiz-end-component.test.js diff --git a/src/__tests__/part5/quiz-component-has-conditional.test.js b/src/__tests__/module4/quiz-component-has-conditional.test.js similarity index 100% rename from src/__tests__/part5/quiz-component-has-conditional.test.js rename to src/__tests__/module4/quiz-component-has-conditional.test.js diff --git a/src/__tests__/part5/quiz-component-has-is-quiz-end-const.test.js b/src/__tests__/module4/quiz-component-has-is-quiz-end-const.test.js similarity index 100% rename from src/__tests__/part5/quiz-component-has-is-quiz-end-const.test.js rename to src/__tests__/module4/quiz-component-has-is-quiz-end-const.test.js diff --git a/src/__tests__/part5/quiz-component-imports-quiz-end-component.test.js b/src/__tests__/module4/quiz-component-imports-quiz-end-component.test.js similarity index 100% rename from src/__tests__/part5/quiz-component-imports-quiz-end-component.test.js rename to src/__tests__/module4/quiz-component-imports-quiz-end-component.test.js diff --git a/src/__tests__/part5/quiz-end-component-exists.test.js b/src/__tests__/module4/quiz-end-component-exists.test.js similarity index 100% rename from src/__tests__/part5/quiz-end-component-exists.test.js rename to src/__tests__/module4/quiz-end-component-exists.test.js diff --git a/src/__tests__/part5/quiz-end-component-has-quiz-end-class.test.js b/src/__tests__/module4/quiz-end-component-has-quiz-end-class.test.js similarity index 100% rename from src/__tests__/part5/quiz-end-component-has-quiz-end-class.test.js rename to src/__tests__/module4/quiz-end-component-has-quiz-end-class.test.js diff --git a/src/__tests__/part5/quiz-end-component-has-render-method.test.js b/src/__tests__/module4/quiz-end-component-has-render-method.test.js similarity index 100% rename from src/__tests__/part5/quiz-end-component-has-render-method.test.js rename to src/__tests__/module4/quiz-end-component-has-render-method.test.js diff --git a/src/__tests__/part5/quiz-end-component-imports-react.test.js b/src/__tests__/module4/quiz-end-component-imports-react.test.js similarity index 100% rename from src/__tests__/part5/quiz-end-component-imports-react.test.js rename to src/__tests__/module4/quiz-end-component-imports-react.test.js diff --git a/src/__tests__/part6/quiz-has-next-question-handler.test.js b/src/__tests__/module5/quiz-has-next-question-handler.test.js similarity index 100% rename from src/__tests__/part6/quiz-has-next-question-handler.test.js rename to src/__tests__/module5/quiz-has-next-question-handler.test.js diff --git a/src/__tests__/part6/quiz-question-button-components-have-correct-props.test.js b/src/__tests__/module5/quiz-question-button-components-have-correct-props.test.js similarity index 100% rename from src/__tests__/part6/quiz-question-button-components-have-correct-props.test.js rename to src/__tests__/module5/quiz-question-button-components-have-correct-props.test.js diff --git a/src/__tests__/part6/quiz-question-button-handle-click-method-returns-correct-value.test.js b/src/__tests__/module5/quiz-question-button-handle-click-method-returns-correct-value.test.js similarity index 100% rename from src/__tests__/part6/quiz-question-button-handle-click-method-returns-correct-value.test.js rename to src/__tests__/module5/quiz-question-button-handle-click-method-returns-correct-value.test.js diff --git a/src/__tests__/part6/quiz-question-button-has-onclick-handler.test.js b/src/__tests__/module5/quiz-question-button-has-onclick-handler.test.js similarity index 100% rename from src/__tests__/part6/quiz-question-button-has-onclick-handler.test.js rename to src/__tests__/module5/quiz-question-button-has-onclick-handler.test.js diff --git a/src/__tests__/part6/quiz-question-component-maps-multiple-button-components.test.js b/src/__tests__/module5/quiz-question-component-maps-multiple-button-components.test.js similarity index 100% rename from src/__tests__/part6/quiz-question-component-maps-multiple-button-components.test.js rename to src/__tests__/module5/quiz-question-component-maps-multiple-button-components.test.js diff --git a/src/__tests__/part6/quiz-question-handle-click-method-returns-correct-value.test.js b/src/__tests__/module5/quiz-question-handle-click-method-returns-correct-value.test.js similarity index 100% rename from src/__tests__/part6/quiz-question-handle-click-method-returns-correct-value.test.js rename to src/__tests__/module5/quiz-question-handle-click-method-returns-correct-value.test.js diff --git a/src/__tests__/part6/quiz-question-has-onclick-handler.test.js b/src/__tests__/module5/quiz-question-has-onclick-handler.test.js similarity index 100% rename from src/__tests__/part6/quiz-question-has-onclick-handler.test.js rename to src/__tests__/module5/quiz-question-has-onclick-handler.test.js diff --git a/src/__tests__/part6/quiz-show-next-question-increments-position-state.test.js b/src/__tests__/module5/quiz-show-next-question-increments-position-state.test.js similarity index 100% rename from src/__tests__/part6/quiz-show-next-question-increments-position-state.test.js rename to src/__tests__/module5/quiz-show-next-question-increments-position-state.test.js diff --git a/src/__tests__/part7/quiz-question-component-constructor-sets-state.test.js b/src/__tests__/module6/quiz-question-component-constructor-sets-state.test.js similarity index 100% rename from src/__tests__/part7/quiz-question-component-constructor-sets-state.test.js rename to src/__tests__/module6/quiz-question-component-constructor-sets-state.test.js diff --git a/src/__tests__/part7/quiz-question-component-has-constructor-function.test.js b/src/__tests__/module6/quiz-question-component-has-constructor-function.test.js similarity index 100% rename from src/__tests__/part7/quiz-question-component-has-constructor-function.test.js rename to src/__tests__/module6/quiz-question-component-has-constructor-function.test.js diff --git a/src/__tests__/part7/quiz-question-component-sets-correct-state.test.js b/src/__tests__/module6/quiz-question-component-sets-correct-state.test.js similarity index 100% rename from src/__tests__/part7/quiz-question-component-sets-correct-state.test.js rename to src/__tests__/module6/quiz-question-component-sets-correct-state.test.js diff --git a/src/__tests__/part7/quiz-question-component-shows-error-tag.test.js b/src/__tests__/module6/quiz-question-component-shows-error-tag.test.js similarity index 100% rename from src/__tests__/part7/quiz-question-component-shows-error-tag.test.js rename to src/__tests__/module6/quiz-question-component-shows-error-tag.test.js diff --git a/src/__tests__/part8/quiz-end-component-anchor-has-onclick-handler.test.js b/src/__tests__/module7/quiz-end-component-anchor-has-onclick-handler.test.js similarity index 100% rename from src/__tests__/part8/quiz-end-component-anchor-has-onclick-handler.test.js rename to src/__tests__/module7/quiz-end-component-anchor-has-onclick-handler.test.js diff --git a/src/__tests__/part8/quiz-end-handle-click-method-returns-correct-value.test.js b/src/__tests__/module7/quiz-end-handle-click-method-returns-correct-value.test.js similarity index 100% rename from src/__tests__/part8/quiz-end-handle-click-method-returns-correct-value.test.js rename to src/__tests__/module7/quiz-end-handle-click-method-returns-correct-value.test.js diff --git a/src/__tests__/part8/quiz-end-has-reset-click-handler.test.js b/src/__tests__/module7/quiz-end-has-reset-click-handler.test.js similarity index 100% rename from src/__tests__/part8/quiz-end-has-reset-click-handler.test.js rename to src/__tests__/module7/quiz-end-has-reset-click-handler.test.js diff --git a/src/__tests__/part8/quiz-handle-reset-click-sets-position-state.test.js b/src/__tests__/module7/quiz-handle-reset-click-sets-position-state.test.js similarity index 100% rename from src/__tests__/part8/quiz-handle-reset-click-sets-position-state.test.js rename to src/__tests__/module7/quiz-handle-reset-click-sets-position-state.test.js From e6931608a45a69c723ce8029f82aaea46a182da3 Mon Sep 17 00:00:00 2001 From: Jon Friskics Date: Fri, 25 May 2018 00:14:48 -0400 Subject: [PATCH 11/23] fix incorrect test tag in module 1 --- src/__tests__/module1/quiz-component-requires-quiz-json.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/__tests__/module1/quiz-component-requires-quiz-json.test.js b/src/__tests__/module1/quiz-component-requires-quiz-json.test.js index 003cf3e201..c0f5c36df4 100644 --- a/src/__tests__/module1/quiz-component-requires-quiz-json.test.js +++ b/src/__tests__/module1/quiz-component-requires-quiz-json.test.js @@ -8,7 +8,7 @@ let fs = require('fs'); let babylon = require('babylon') describe('Quiz Component', () => { - it('requires quiz_data.json @quiz-component-imports-css', () => { + it('requires quiz_data.json @quiz-component-requires-quiz-json', () => { let file; try { file = fs.readFileSync(__dirname + '/../../Quiz.js').toString(); From 20a03c69522e26d70cbbb805d041d642dd4010e5 Mon Sep 17 00:00:00 2001 From: Jon Friskics Date: Fri, 25 May 2018 00:16:29 -0400 Subject: [PATCH 12/23] fix incorrect test tags in module 5 --- .../quiz-question-button-components-have-correct-props.test.js | 2 +- ...ion-button-handle-click-method-returns-correct-value.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/__tests__/module5/quiz-question-button-components-have-correct-props.test.js b/src/__tests__/module5/quiz-question-button-components-have-correct-props.test.js index 074225e99f..8a15d89ca2 100644 --- a/src/__tests__/module5/quiz-question-button-components-have-correct-props.test.js +++ b/src/__tests__/module5/quiz-question-button-components-have-correct-props.test.js @@ -26,7 +26,7 @@ let fs = require('fs'); let quizData = require('../../quiz_data.json') describe('QuizQuestion Component', () => { - it('has QuizQuestionButton components with correct props @quiz-question-button-component-has-correct-props', () => { + it('has QuizQuestionButton components with correct props @quiz-question-button-components-have-correct-props', () => { assert(quizQuestionComponentExists, "The QuizQuestion component hasn't been created yet.") assert(quizQuestionButtonComponentExists, "The QuizQuestionButton component hasn't been created yet.") diff --git a/src/__tests__/module5/quiz-question-button-handle-click-method-returns-correct-value.test.js b/src/__tests__/module5/quiz-question-button-handle-click-method-returns-correct-value.test.js index b6b45af9b7..ab5227772d 100644 --- a/src/__tests__/module5/quiz-question-button-handle-click-method-returns-correct-value.test.js +++ b/src/__tests__/module5/quiz-question-button-handle-click-method-returns-correct-value.test.js @@ -15,7 +15,7 @@ try { } describe('QuizQuestionButton Component', () => { - it('has a button with an onClick handler @quiz-question-button-has-onclick-handler', () => { + it('has a button with an onClick handler @quiz-question-button-handle-click-method-returns-correct-value', () => { assert(quizQuestionButtonComponentExists, "The QuizQuestionButton component hasn't been created yet.") let spy From 15632fad8fc124ec68bad8ab940986e1fdb10ae3 Mon Sep 17 00:00:00 2001 From: Jon Friskics Date: Fri, 25 May 2018 23:42:18 -0400 Subject: [PATCH 13/23] fix typo fixes #2 --- ...z-question-handle-click-method-returns-correct-value.test.js | 2 +- .../module6/quiz-question-component-sets-correct-state.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/__tests__/module5/quiz-question-handle-click-method-returns-correct-value.test.js b/src/__tests__/module5/quiz-question-handle-click-method-returns-correct-value.test.js index 9f511cbd1a..42a378e40c 100644 --- a/src/__tests__/module5/quiz-question-handle-click-method-returns-correct-value.test.js +++ b/src/__tests__/module5/quiz-question-handle-click-method-returns-correct-value.test.js @@ -33,7 +33,7 @@ try { } describe('QuizQuestion Component', () => { - it('handleClick method has conditional that checks arugment and called clickHandler @quiz-question-handle-click-method-returns-correct-value', () => { + it('handleClick method has conditional that checks argument and called clickHandler @quiz-question-handle-click-method-returns-correct-value', () => { assert(quizComponentExists, "The Quiz component hasn't been created yet.") assert(quizQuestionComponentExists, "The QuizQuestion component hasn't been created yet.") assert(quizQuestionButtonComponentExists, "The QuizQuestionButton component hasn't been created yet.") diff --git a/src/__tests__/module6/quiz-question-component-sets-correct-state.test.js b/src/__tests__/module6/quiz-question-component-sets-correct-state.test.js index 04ae063389..47a9f3a736 100644 --- a/src/__tests__/module6/quiz-question-component-sets-correct-state.test.js +++ b/src/__tests__/module6/quiz-question-component-sets-correct-state.test.js @@ -33,7 +33,7 @@ try { } describe('QuizQuestion Component', () => { - it('handleClick method has conditional that checks arugment and called clickHandler @quiz-question-component-sets-correct-state', () => { + it('handleClick method has conditional that checks argument and called clickHandler @quiz-question-component-sets-correct-state', () => { assert(quizComponentExists, "The Quiz component hasn't been created yet.") assert(quizQuestionComponentExists, "The QuizQuestion component hasn't been created yet.") assert(quizQuestionButtonComponentExists, "The QuizQuestionButton component hasn't been created yet.") From b431bd1c4c11ebd42c561748adc79b0b46d14af6 Mon Sep 17 00:00:00 2001 From: Jon Friskics Date: Fri, 25 May 2018 23:47:07 -0400 Subject: [PATCH 14/23] don't specify jsdom --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 49c74187bf..a8a12bf15d 100644 --- a/package.json +++ b/package.json @@ -10,14 +10,14 @@ "scripts": { "start": "react-scripts start", "build": "react-scripts build", - "test": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom", - "test:module1": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module1", - "test:module2": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module2", - "test:module3": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module3", - "test:module4": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module4", - "test:module5": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module5", - "test:module6": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module6", - "test:module7": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module7", + "test": "CI=true ./node_modules/.bin/cross-env react-scripts test", + "test:module1": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module1", + "test:module2": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module2", + "test:module3": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module3", + "test:module4": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module4", + "test:module5": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module5", + "test:module6": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module6", + "test:module7": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module7", "eject": "react-scripts eject" }, "jest": { From 2c5c8ba4fca57fcf505c9cd990deaf82896a7665 Mon Sep 17 00:00:00 2001 From: Jon Friskics Date: Fri, 25 May 2018 23:56:43 -0400 Subject: [PATCH 15/23] remove jsdom and silence npm run error --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index a8a12bf15d..096849b4ff 100644 --- a/package.json +++ b/package.json @@ -10,14 +10,14 @@ "scripts": { "start": "react-scripts start", "build": "react-scripts build", - "test": "CI=true ./node_modules/.bin/cross-env react-scripts test", - "test:module1": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module1", - "test:module2": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module2", - "test:module3": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module3", - "test:module4": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module4", - "test:module5": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module5", - "test:module6": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module6", - "test:module7": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module7", + "test": "CI=true ./node_modules/.bin/cross-env react-scripts test || true", + "test:module1": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module1 || true", + "test:module2": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module2 || true", + "test:module3": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module3 || true", + "test:module4": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module4 || true", + "test:module5": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module5 || true", + "test:module6": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module6 || true", + "test:module7": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module7 || true", "eject": "react-scripts eject" }, "jest": { From 9c8db3209b85b80c18da5ad345a63e98324cc86a Mon Sep 17 00:00:00 2001 From: Jon Friskics Date: Mon, 28 May 2018 12:35:16 -0400 Subject: [PATCH 16/23] fix module 1 tests so tasks 8 and 9 don't pass prematurely, and remove console.logs() --- .../module1/quiz-component-displays-instruction-text.test.js | 1 - .../module1/quiz-component-has-quiz-question-div.test.js | 1 - .../module1/quiz-component-has-render-method.test.js | 4 +--- .../module2/quiz-question-component-has-render-method.test.js | 1 - ...question-handle-click-method-returns-correct-value.test.js | 1 - ...quiz-end-handle-click-method-returns-correct-value.test.js | 1 - 6 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/__tests__/module1/quiz-component-displays-instruction-text.test.js b/src/__tests__/module1/quiz-component-displays-instruction-text.test.js index f9368648c6..8c0e57024d 100644 --- a/src/__tests__/module1/quiz-component-displays-instruction-text.test.js +++ b/src/__tests__/module1/quiz-component-displays-instruction-text.test.js @@ -29,7 +29,6 @@ describe('Quiz Component', () => { if (quiz.find('.QuizQuestion').length > 0) { assert(quiz.find('.QuizQuestion').text() == quizData.quiz_questions[0].instruction_text, "The div with a className of `QuizQuestion` isn't displaying the correct instruction text.") - } else if (quiz.find('QuizQuestion')) { } else { assert(false, "There is not a div with a className of QuizQuestion yet.") } diff --git a/src/__tests__/module1/quiz-component-has-quiz-question-div.test.js b/src/__tests__/module1/quiz-component-has-quiz-question-div.test.js index 42145f92f9..7e01e8fa2b 100644 --- a/src/__tests__/module1/quiz-component-has-quiz-question-div.test.js +++ b/src/__tests__/module1/quiz-component-has-quiz-question-div.test.js @@ -37,7 +37,6 @@ describe('Quiz Component', () => { assert(el.props.children == quizData.quiz_questions[0].instruction_text) } } - } else if (quiz.find('QuizQuestion')) { } else if (quiz.containsMatchingElement(
Quiz
)) { // this block will run until @quiz-component-has-quiz-question-div assert(false, "The Quiz component isn't rendering a single div with the class `QuizQuestion`.") diff --git a/src/__tests__/module1/quiz-component-has-render-method.test.js b/src/__tests__/module1/quiz-component-has-render-method.test.js index 01004e1a17..44658640d5 100644 --- a/src/__tests__/module1/quiz-component-has-render-method.test.js +++ b/src/__tests__/module1/quiz-component-has-render-method.test.js @@ -29,15 +29,13 @@ describe('Quiz Component', () => { if (quiz.containsMatchingElement(
)) { // this block will run after @quiz-component-has-quiz-question-div - } else if ( quiz.find('.QuizQuestion').getElements().length == 1) { + } else if (quiz.find('.QuizQuestion').getElements().length == 1) { let el = quiz.find('.QuizQuestion').getElements()[0]; if (el.props.className == 'QuizQuestion') { if (el.props.children == null) { assert(el.props.children == quizData.quiz_questions[0].instruction_text) } } - } else if (quiz.find('QuizQuestion')) { - // this block will run after @quiz-component-displays-quiz-question-component } else { // this block will run until @quiz-component-has-quiz-question-div assert(quiz.containsMatchingElement(
Quiz
), "The Quiz component isn't rendering a single div with the text `Quiz`.") diff --git a/src/__tests__/module2/quiz-question-component-has-render-method.test.js b/src/__tests__/module2/quiz-question-component-has-render-method.test.js index e78ff37aa2..245a86f55c 100644 --- a/src/__tests__/module2/quiz-question-component-has-render-method.test.js +++ b/src/__tests__/module2/quiz-question-component-has-render-method.test.js @@ -37,7 +37,6 @@ describe('QuizQuestion Component', () => { assert(div.querySelector('main') != null, "We can't find a `main` tag in the QuizQuestion component's JSX.") assert(div.querySelectorAll('main section') != null, "We can't find a `main` tag with a child of `section` in the QuizQuestion component's JSX.") assert(div.querySelectorAll('main section').length == 2, "We're finding some `section` tags that are children of a `main` tag, but we'd like there to be exactly *2* `section` tags - if you're having trouble, just copy the HTML that we've provided in the task instructions.") - // console.log(div.querySelector('main section')) assert(div.querySelectorAll('main section')[0].querySelector('p'), "We can't find a `section` tag with a child of `p` in the QuizQuestion component's JSX.") assert(div.querySelectorAll('main section')[1].querySelector('ul'), "We can't find a `ul` tag with a child of `li` in the QuizQuestion component's JSX.") }) diff --git a/src/__tests__/module5/quiz-question-handle-click-method-returns-correct-value.test.js b/src/__tests__/module5/quiz-question-handle-click-method-returns-correct-value.test.js index 42a378e40c..8c86c44d23 100644 --- a/src/__tests__/module5/quiz-question-handle-click-method-returns-correct-value.test.js +++ b/src/__tests__/module5/quiz-question-handle-click-method-returns-correct-value.test.js @@ -42,7 +42,6 @@ describe('QuizQuestion Component', () => { try { quiz = shallow() } catch (e) { - console.log(e) assert(false, "We weren't able to mount the Quiz component.") } diff --git a/src/__tests__/module7/quiz-end-handle-click-method-returns-correct-value.test.js b/src/__tests__/module7/quiz-end-handle-click-method-returns-correct-value.test.js index fac2009d7c..eb10aaad16 100644 --- a/src/__tests__/module7/quiz-end-handle-click-method-returns-correct-value.test.js +++ b/src/__tests__/module7/quiz-end-handle-click-method-returns-correct-value.test.js @@ -32,7 +32,6 @@ describe('QuizEnd Component', () => { try { quiz = shallow() } catch (e) { - console.log(e) assert(false, "We weren't able to mount the Quiz component.") } From eb2cc00f46e12d29003aedc6fd5616e79146a337 Mon Sep 17 00:00:00 2001 From: Jon Friskics Date: Mon, 28 May 2018 12:39:35 -0400 Subject: [PATCH 17/23] add jsdom back to test scripts --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 096849b4ff..35ae7748b4 100644 --- a/package.json +++ b/package.json @@ -10,14 +10,14 @@ "scripts": { "start": "react-scripts start", "build": "react-scripts build", - "test": "CI=true ./node_modules/.bin/cross-env react-scripts test || true", - "test:module1": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module1 || true", - "test:module2": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module2 || true", - "test:module3": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module3 || true", - "test:module4": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module4 || true", - "test:module5": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module5 || true", - "test:module6": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module6 || true", - "test:module7": "CI=true ./node_modules/.bin/cross-env react-scripts test --noStackTrace src/__tests__/module7 || true", + "test": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace || true", + "test:module1": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module1 || true", + "test:module2": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module2 || true", + "test:module3": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module3 || true", + "test:module4": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module4 || true", + "test:module5": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module5 || true", + "test:module6": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module6 || true", + "test:module7": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module7 || true", "eject": "react-scripts eject" }, "jest": { From 6f747e5eba06be960dd63a8bc5607c2a9990d685 Mon Sep 17 00:00:00 2001 From: Jon Friskics Date: Mon, 28 May 2018 13:04:11 -0400 Subject: [PATCH 18/23] update module 1 tests to still pass when certain conditions are eventually met in module 2 --- ...quiz-component-displays-instruction-text.test.js | 13 +++++++++++++ .../quiz-component-has-quiz-question-div.test.js | 13 +++++++++++++ .../quiz-component-has-render-method.test.js | 13 +++++++++++++ 3 files changed, 39 insertions(+) diff --git a/src/__tests__/module1/quiz-component-displays-instruction-text.test.js b/src/__tests__/module1/quiz-component-displays-instruction-text.test.js index 8c0e57024d..e217809c6a 100644 --- a/src/__tests__/module1/quiz-component-displays-instruction-text.test.js +++ b/src/__tests__/module1/quiz-component-displays-instruction-text.test.js @@ -13,6 +13,15 @@ try { quizComponentExists = false; } +let quizQuestionComponentExists = false; +let QuizQuestion; +try { + QuizQuestion = require('../../QuizQuestion.js').default; + quizQuestionComponentExists = true; +} catch (e) { + quizQuestionComponentExists = false; +} + let fs = require('fs'); let quizData = require('../../quiz_data.json') @@ -29,6 +38,10 @@ describe('Quiz Component', () => { if (quiz.find('.QuizQuestion').length > 0) { assert(quiz.find('.QuizQuestion').text() == quizData.quiz_questions[0].instruction_text, "The div with a className of `QuizQuestion` isn't displaying the correct instruction text.") + } else if (quizQuestionComponentExists) { + if (quiz.containsMatchingElement()) { + // this block will run after @quiz-question-component-has-render-method in module 2 + } } else { assert(false, "There is not a div with a className of QuizQuestion yet.") } diff --git a/src/__tests__/module1/quiz-component-has-quiz-question-div.test.js b/src/__tests__/module1/quiz-component-has-quiz-question-div.test.js index 7e01e8fa2b..72726bad11 100644 --- a/src/__tests__/module1/quiz-component-has-quiz-question-div.test.js +++ b/src/__tests__/module1/quiz-component-has-quiz-question-div.test.js @@ -13,6 +13,15 @@ try { quizComponentExists = false; } +let quizQuestionComponentExists = false; +let QuizQuestion; +try { + QuizQuestion = require('../../QuizQuestion.js').default; + quizQuestionComponentExists = true; +} catch (e) { + quizQuestionComponentExists = false; +} + let fs = require('fs'); let quizData = require('../../quiz_data.json') @@ -40,6 +49,10 @@ describe('Quiz Component', () => { } else if (quiz.containsMatchingElement(
Quiz
)) { // this block will run until @quiz-component-has-quiz-question-div assert(false, "The Quiz component isn't rendering a single div with the class `QuizQuestion`.") + } else if (quizQuestionComponentExists) { + if (quiz.containsMatchingElement()) { + // this block will run after @quiz-question-component-has-render-method in module 2 + } } else { assert(false, "The Quiz component isn't rendering a single div with the class `QuizQuestion`.") } diff --git a/src/__tests__/module1/quiz-component-has-render-method.test.js b/src/__tests__/module1/quiz-component-has-render-method.test.js index 44658640d5..0cfd14ec60 100644 --- a/src/__tests__/module1/quiz-component-has-render-method.test.js +++ b/src/__tests__/module1/quiz-component-has-render-method.test.js @@ -13,6 +13,15 @@ try { quizComponentExists = false; } +let quizQuestionComponentExists = false; +let QuizQuestion; +try { + QuizQuestion = require('../../QuizQuestion.js').default; + quizQuestionComponentExists = true; +} catch (e) { + quizQuestionComponentExists = false; +} + let fs = require('fs'); let quizData = require('../../quiz_data.json') @@ -36,6 +45,10 @@ describe('Quiz Component', () => { assert(el.props.children == quizData.quiz_questions[0].instruction_text) } } + } else if (quizQuestionComponentExists) { + if (quiz.containsMatchingElement()) { + // this block will run after @quiz-question-component-has-render-method in module 2 + } } else { // this block will run until @quiz-component-has-quiz-question-div assert(quiz.containsMatchingElement(
Quiz
), "The Quiz component isn't rendering a single div with the text `Quiz`.") From 755125ba9337d542c69abc60370c86cdfe470a73 Mon Sep 17 00:00:00 2001 From: Jon Friskics Date: Thu, 31 May 2018 09:58:12 -0600 Subject: [PATCH 19/23] update README --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index d40c87ebc8..f91a811bf3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ +# Build a Quiz Component with React + +This repo contains the code for the Pluralsight Project "Build a Quiz Component with React," located here: https://app.pluralsight.com/projects/build-a-quiz-component-with-react/ + +This project was generated with `create-react-app` version 1.5.2. + +## All of the text that appears below is auto-generated by Create React App: + This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app). Below you will find some information on how to perform common tasks.
From 2910c1b66aea57bef3145e5b2432b4bbe66a181b Mon Sep 17 00:00:00 2001 From: Jon Friskics Date: Wed, 6 Jun 2018 00:40:59 -0400 Subject: [PATCH 20/23] fix position of CI env variable in test commands --- package-lock.json | 2 +- package.json | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5603075d70..37dc9688c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "build-a-quiz-component-with-react", - "version": "0.1.0", + "version": "0.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 35ae7748b4..ae0deb87fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "build-a-quiz-component-with-react", - "version": "0.1.0", + "version": "0.1.1", "private": true, "dependencies": { "react": "16.2.0", @@ -10,14 +10,14 @@ "scripts": { "start": "react-scripts start", "build": "react-scripts build", - "test": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace || true", - "test:module1": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module1 || true", - "test:module2": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module2 || true", - "test:module3": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module3 || true", - "test:module4": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module4 || true", - "test:module5": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module5 || true", - "test:module6": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module6 || true", - "test:module7": "CI=true ./node_modules/.bin/cross-env react-scripts test --env=jsdom --noStackTrace src/__tests__/module7 || true", + "test": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace || true", + "test:module1": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace src/__tests__/module1 || true", + "test:module2": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace src/__tests__/module2 || true", + "test:module3": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace src/__tests__/module3 || true", + "test:module4": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace src/__tests__/module4 || true", + "test:module5": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace src/__tests__/module5 || true", + "test:module6": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace src/__tests__/module6 || true", + "test:module7": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace src/__tests__/module7 || true", "eject": "react-scripts eject" }, "jest": { From b20627285503353821d02de33494095696637f5b Mon Sep 17 00:00:00 2001 From: "Mason, Bryan" Date: Thu, 7 Jun 2018 09:31:15 -0600 Subject: [PATCH 21/23] Fixed #5 pattern matching for module specific test command. --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index ae0deb87fe..80efaf7c79 100644 --- a/package.json +++ b/package.json @@ -11,13 +11,13 @@ "start": "react-scripts start", "build": "react-scripts build", "test": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace || true", - "test:module1": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace src/__tests__/module1 || true", - "test:module2": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace src/__tests__/module2 || true", - "test:module3": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace src/__tests__/module3 || true", - "test:module4": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace src/__tests__/module4 || true", - "test:module5": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace src/__tests__/module5 || true", - "test:module6": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace src/__tests__/module6 || true", - "test:module7": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace src/__tests__/module7 || true", + "test:module1": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace module1 || true", + "test:module2": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace module2 || true", + "test:module3": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace module3 || true", + "test:module4": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace module4 || true", + "test:module5": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace module5 || true", + "test:module6": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace module6 || true", + "test:module7": "./node_modules/.bin/cross-env CI=true react-scripts test --env=jsdom --noStackTrace module7 || true", "eject": "react-scripts eject" }, "jest": { From 6b1b0eb02bd5811705dca4fa313b42abf99dfead Mon Sep 17 00:00:00 2001 From: Will Date: Wed, 24 Oct 2018 08:25:21 -0400 Subject: [PATCH 22/23] Add Dockerfile Signed-off-by: Will --- .dockerignore | 1 + Dockerfile | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..3c3629e647 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +node_modules diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..d69f533201 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM node:9.9-alpine + +ENV APP_DIR /src/app/ + +RUN mkdir -p $APP_DIR + +ADD ./package.json ${APP_DIR} + +WORKDIR $APP_DIR + +RUN ["npm", "install"] + +COPY . . From 69a2dab5da6841e6fe801a1da0f07f177a9ee633 Mon Sep 17 00:00:00 2001 From: Jaron Thatcher Date: Thu, 21 Mar 2019 10:15:57 -0700 Subject: [PATCH 23/23] Create .gitattributes --- .gitattributes | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..fbf9358b0e --- /dev/null +++ b/.gitattributes @@ -0,0 +1,14 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text=auto + +# Explicitly declare text files you want to always be normalized and converted +# to native line endings on checkout. +*.c text +*.h text + +# Declare files that will always have CRLF line endings on checkout. +*.sln text eol=crlf + +# Denote all files that are truly binary and should not be modified. +*.png binary +*.jpg binary