Scissors Marisa#55
Open
Supermobarbie wants to merge 3 commits into
Open
Conversation
…ave 2 test to test for 'O' and 'X' instead of 'o' and 'x' as well as moving SAMPLE_BOARD outside of any one function so it could be accessed by all functions
beccaelenzil
left a comment
There was a problem hiding this comment.
Good work on this React project. It is clear that you have met the learning goals around working with state and event handling in nested components. I have pointed out a few small changes that makes all the tests pass (they are picky tests). Looking forward to talking about this project more in our 1:1.
| clicked = true; | ||
|
|
||
| setNumSquaresClicked(numSquaresClicked + 1); | ||
| if (currentPlayer === PLAYER_1) { |
There was a problem hiding this comment.
Just note you can use a ternary here: setPlayer( currentPlayer === PLAYER_1 ? PLAYER_2 : PLAYER_1);
| <header className="App-header"> | ||
| <h1>React Tic Tac Toe</h1> | ||
| <h2>The winner is ... -- Fill in for wave 3 </h2> | ||
| <h1>Marisa's Tic Tac Toe</h1> |
There was a problem hiding this comment.
Minor note, the test is looking for the Header to be React Tic Tac Toe
render(<App />);
35 |
> 36 | const header = screen.getByText('React Tic Tac Toe');
| ^
37 |
38 | // Assert
39 | expect(header).toBeInTheDocument();
| <h2>The winner is ... -- Fill in for wave 3 </h2> | ||
| <h1>Marisa's Tic Tac Toe</h1> | ||
| <h2>It's {currentPlayer}'s turn</h2> | ||
| <h2>{`The Winner is ${winner}`}</h2> |
There was a problem hiding this comment.
The test is looking for x to be lower case and the exact test Winner is x
App › Prints "Winner is o" when o wins › that a winner will be identified when 3 Os go accross the top-right to bottom-left
expect(received).toEqual(expected) // deep equality
Expected: "X"
Received: "x"
12 |
13 | buttons = container.querySelectorAll('.grid button');
> 14 | expect(buttons[buttonIndex].innerHTML).toEqual(expectedResult);
| ^
15 | }
16 |
17 | describe('Wave 2: clicking on squares and rendering App', () => {
at clickButtonAndVerifyResult (src/App.test.js:14:44)
at Object.<anonymous> (src/App.test.js:353:7)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.