Skip to content

Commit 380f9a1

Browse files
committed
update tests to match quizData variable using camelCase
1 parent a958cbd commit 380f9a1

21 files changed

Lines changed: 30 additions & 39 deletions

‎src/__tests__/part2/quiz-component-constructor-sets-state.test.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ try {
1414
}
1515

1616
let fs = require('fs');
17-
let quiz_data = require('../../quiz_data.json')
17+
let quizData = require('../../quiz_data.json')
1818

1919
describe('Quiz Component', () => {
2020
it('constructor sets the state to the quiz_data JSON @quiz-component-constructor-sets-state', () => {
@@ -28,6 +28,6 @@ describe('Quiz Component', () => {
2828
}
2929

3030
assert(quiz.state() != null, "We don't see that you're setting the state in the Quiz component constructor.")
31-
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`")
31+
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`")
3232
})
3333
})

‎src/__tests__/part2/quiz-component-displays-instruction-text.test.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ try {
1414
}
1515

1616
let fs = require('fs');
17-
let quiz_data = require('../../quiz_data.json')
17+
let quizData = require('../../quiz_data.json')
1818

1919
describe('Quiz Component', () => {
2020
it('displays the instruction text from JSON data @quiz-component-displays-instruction-text', () => {
@@ -28,7 +28,7 @@ describe('Quiz Component', () => {
2828
}
2929

3030
if (quiz.find('.QuizQuestion').length > 0) {
31-
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.")
31+
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.")
3232
} else {
3333
assert(false, "There is not a div with a className of QuizQuestion yet.")
3434
}

‎src/__tests__/part2/quiz-component-has-quiz-question-div.test.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ try {
1414
}
1515

1616
let fs = require('fs');
17-
let quiz_data = require('../../quiz_data.json')
1817

1918
describe('Quiz Component', () => {
2019
it('renders a div with a className of `QuizQuestion` @quiz-component-has-quiz-question-div', () => {

‎src/__tests__/part2/quiz-component-has-render-method.test.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ try {
1414
}
1515

1616
let fs = require('fs');
17-
let quiz_data = require('../../quiz_data.json')
17+
let quizData = require('../../quiz_data.json')
1818

1919
describe('Quiz Component', () => {
2020
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', () => {
3333
let el = quiz.find('.QuizQuestion').getElements()[0];
3434
if (el.props.className == 'QuizQuestion') {
3535
if (el.props.children == null) {
36-
assert(el.props.children == quiz_data.quiz_questions[0].instruction_text)
36+
assert(el.props.children == quizData.quiz_questions[0].instruction_text)
3737
}
3838
}
3939
} else if (quiz.find('QuizQuestion')) {

‎src/__tests__/part2/quiz-component-requires-quiz-json.test.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,24 @@ describe('Quiz Component', () => {
2424
ast['program']['body'].forEach(element => {
2525
if (element.type == 'VariableDeclaration') {
2626
if (element.kind == 'let') {
27-
if (element.declarations[0].id.name == 'quiz_data') {
27+
if (element.declarations[0].id.name == 'quizData') {
2828
if (element.declarations[0].init.callee.name == 'require') {
2929
if (element.declarations[0].init.arguments[0].value == './quiz_data.json') {
3030
quiz_data_loaded_correctly = true
3131
} else {
32-
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.")
32+
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.")
3333
}
3434
} else {
3535
assert(false, "Make sure you're using the `require` function to load the `quiz_data.json` file into a variable.")
3636
}
3737
} else {
38-
assert(false, "We'd like you to name your variable `quiz_data`.")
38+
assert(false, "We'd like you to name your variable `quizData`.")
3939
}
4040
} else {
4141
assert(false, "We can't find where you're creating a variable with the `let` keyword.")
4242
}
4343
}
4444
})
45-
assert(quiz_data_loaded_correctly, "We can't find where you're loading the quiz_data JSON into a variable named quiz_data.")
45+
assert(quiz_data_loaded_correctly, "We can't find where you're loading the quiz_data JSON into a variable named quizData.")
4646
});
4747
})

‎src/__tests__/part3/quiz-question-component-has-correct-li-value.test.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ try {
2323
}
2424

2525
let fs = require('fs');
26-
let quiz_data = require('../../quiz_data.json')
26+
let quizData = require('../../quiz_data.json')
2727

2828
describe('QuizQuestion Component', () => {
2929
it('has li tag with correct value @quiz-question-component-has-correct-li-value', () => {
@@ -52,7 +52,7 @@ describe('QuizQuestion Component', () => {
5252
// this runs after @quiz-question-component-displays-quiz-question-button-component
5353
} else {
5454
let li_contents = div.querySelectorAll('main section ul li')[0]
55-
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.")
55+
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.")
5656
}
5757
})
5858
})

‎src/__tests__/part3/quiz-question-component-has-quiz-question-prop.test.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ try {
2323
}
2424

2525
let fs = require('fs');
26-
let quiz_data = require('../../quiz_data.json')
26+
let quizData = require('../../quiz_data.json')
2727

2828
describe('Quiz Component', () => {
2929
it('has QuizQuestion component with correct prop @@quiz-question-component-has-quiz-question-prop', () => {
@@ -39,6 +39,6 @@ describe('Quiz Component', () => {
3939

4040
assert(quiz.find('QuizQuestion').length == 1, "We couldn't find the QuizQuestion component being loaded by the Quiz component")
4141
assert(quiz.find('QuizQuestion').props().quiz_question != null, "The QuizQuestion component exists, but there's no prop named `quiz_question`.")
42-
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.")
42+
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.")
4343
})
4444
})

‎src/__tests__/part3/quiz-question-displays-instruction-text.test.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ try {
2323
}
2424

2525
let fs = require('fs');
26-
let quiz_data = require('../../quiz_data.json')
26+
let quizData = require('../../quiz_data.json')
2727

2828
describe('QuizQuestion Component', () => {
2929
it('displays correct instruction text @quiz-question-displays-instruction-text', () => {
@@ -49,6 +49,6 @@ describe('QuizQuestion Component', () => {
4949
assert(div.querySelector('main') != null, "no main")
5050
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.")
5151
let p_contents = div.querySelectorAll('main section p')[0]
52-
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.")
52+
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.")
5353
})
5454
})

‎src/__tests__/part4/quiz-question-button-component-displays-button-text.test.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ try {
1414
}
1515

1616
let fs = require('fs');
17-
let quiz_data = require('../../quiz_data.json')
17+
let quizData = require('../../quiz_data.json')
1818

1919
describe('QuizQuestionButton Component', () => {
2020
it('displays correct button text @quiz-question-button-component-displays-button-text', () => {
@@ -35,6 +35,6 @@ describe('QuizQuestionButton Component', () => {
3535

3636
assert(div.querySelector('li button') != null, "no li button")
3737
let button_contents = div.querySelectorAll('li button')[0]
38-
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.")
38+
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.")
3939
})
4040
})

‎src/__tests__/part4/quiz-question-button-component-has-button-text-prop.test.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ try {
2323
}
2424

2525
let fs = require('fs');
26-
let quiz_data = require('../../quiz_data.json')
2726

2827
describe('QuizQuestion Component', () => {
2928
it('has QuizQuestionButton component with correct prop @quiz-question-button-component-has-button-text-prop', () => {

0 commit comments

Comments
 (0)