Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.0.0 #105

Merged
merged 56 commits into from
Mar 11, 2024
Merged
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
b7b7303
Feat: Questions and answers are now written in the DB!
UO283615 Mar 8, 2024
53ef89c
Chore: Cleaned up the code a bit
UO283615 Mar 8, 2024
f5705e6
chore: Project renamed
Mar 8, 2024
889965b
chore: Unused imports removed and minor code clean up
Mar 8, 2024
5c9aacc
chore: Comments added on QuestionTemplate and small code clean ups.
Mar 8, 2024
cfc2ce0
chore: Missing comment added on QuestionTemplate
Mar 8, 2024
7a3ab99
chore: Added question generator to the glossary
UO283615 Mar 8, 2024
46ae6d7
Chore: Updated the class diagram
UO283615 Mar 8, 2024
bb53d23
feat: adding all the logic to the game view.
gony02 Mar 8, 2024
c86ccf7
chore: improving the main readme and adding the wireframes.
gony02 Mar 9, 2024
7cacc3c
fix: Adding the .env and modifications in the AuthUtils.js
sergiorodriguezgarcia Mar 9, 2024
bf2c9f7
feat: Making the Signup view to redirect to Login when new user register
sergiorodriguezgarcia Mar 9, 2024
054c847
fix: Changing the tests to pass with the new impl.
sergiorodriguezgarcia Mar 9, 2024
2826b5f
fix: docker compose release thing
Toto-hitori Mar 9, 2024
a1c75de
feat: Adding the custom message to the Login view
sergiorodriguezgarcia Mar 9, 2024
747f463
chore: Added documentation to CountryCapitalQuestion
Mar 9, 2024
4a2ae9c
chore: Added documentation to Jpa
Mar 9, 2024
24dcef1
chore: Code refactoring so AnswerRepositoryImpl and QuestionResposito…
Mar 9, 2024
1ee4594
chore: Code refactoring so AnswerRepositoryImpl and QuestionResposito…
Mar 9, 2024
bd3ef65
chore: Code refactoring so AnswerRepositoryImpl and QuestionResposito…
Mar 9, 2024
4c55598
chore: .mvn package removed from Git
Mar 9, 2024
f01d273
Merge pull request #97 from Arquisoft/feat/questionGeneratorMicroService
Toto-hitori Mar 9, 2024
c68252e
feat: Adding the logout logic to the dashboard
sergiorodriguezgarcia Mar 9, 2024
c1d35b7
Merge pull request #99 from Arquisoft/docs/gonzaloA
sergiorodriguezgarcia Mar 9, 2024
5054399
Merge branch 'develop' into feat/webapp/new-game
sergiorodriguezgarcia Mar 9, 2024
4124070
fix: questions now do not generate duplicate column
Toto-hitori Mar 9, 2024
9b2ac01
fix: questions add answers now
Toto-hitori Mar 9, 2024
fc00173
fix: answering questions not working
Toto-hitori Mar 9, 2024
124c342
fix: saving refresh token
Toto-hitori Mar 9, 2024
11ed3a7
fix: auth not working when reloading
Toto-hitori Mar 10, 2024
3687a93
fix: logout not removing session storage
Toto-hitori Mar 10, 2024
24ee185
fix: passed functions as references
Toto-hitori Mar 10, 2024
17fbf24
chore: removed unecessary terms from the glossary
UO283615 Mar 10, 2024
0865fcc
fix: right now all webapp tests are passing.
gony02 Mar 10, 2024
7013292
Merge pull request #98 from Arquisoft/docs/villanueva
Toto-hitori Mar 10, 2024
e6e9306
feat: creating the logout tests.
gony02 Mar 10, 2024
ea9f930
feat: creating the questions.js tests.
gony02 Mar 10, 2024
26b8a7a
feat: adding more tests cases for the dashboard.
gony02 Mar 10, 2024
bf228cf
feat: adding more tests to the dashboard.
gony02 Mar 10, 2024
cb79327
fix: getQuestions controller deleted
sergioqfeg1 Mar 10, 2024
46d2184
feat: new tests added to the login.
gony02 Mar 10, 2024
8ec2a1e
fix: lang parameter
sergioqfeg1 Mar 10, 2024
1fd2e94
fix: lang parameter added to service and repo
sergioqfeg1 Mar 10, 2024
57f908c
feat: adding more tests to the signup.
gony02 Mar 10, 2024
31ae9f3
fix: problems with service test
sergioqfeg1 Mar 10, 2024
112ac3c
feat: adding more unit tests to the game view.
gony02 Mar 10, 2024
3ba04fd
fix: problems with controller tests
sergioqfeg1 Mar 10, 2024
e07ffe9
fix: fixing the game unit tests.
gony02 Mar 10, 2024
56706d9
feat: adding more tests to the signup
gony02 Mar 10, 2024
3d5e714
Merge pull request #103 from Arquisoft/chore/question-gen-actions
UO283615 Mar 10, 2024
719d453
chore: removed unnecessary image in docker-compose.yml
Toto-hitori Mar 10, 2024
02944f0
Merge pull request #102 from Arquisoft/feat/webapp/new-game
Toto-hitori Mar 10, 2024
fd28553
fix: remove getQuestions
sergioqfeg1 Mar 11, 2024
2ccc0b3
Merge remote-tracking branch 'origin/develop' into hotfix/questionLan…
Toto-hitori Mar 11, 2024
adacaa7
fix: lang is not required
Toto-hitori Mar 11, 2024
e91dc9f
Merge pull request #104 from Arquisoft/hotfix/questionLanguage
Toto-hitori Mar 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: fixing the game unit tests.
  • Loading branch information
gony02 committed Mar 10, 2024
commit e07ffe945f82bc6b2b4e112aa79bd6b05cfd3f22
66 changes: 15 additions & 51 deletions webapp/src/tests/Game.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import React from 'react';
import { render, fireEvent, waitFor } from '@testing-library/react';
import { render, fireEvent } from '@testing-library/react';
import { MemoryRouter } from 'react-router';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';

import Game from '../pages/Game';

const mock = new MockAdapter(axios);

describe('Game component', () => {
test('renders without crashing', () => {
render(<MemoryRouter><Game/></MemoryRouter>);
@@ -39,52 +34,21 @@ describe('Game component', () => {
expect(nextButton).toBeEnabled();
});

test('handles next button click and navigates to results page', async () => {
// Mocking axios call
mock.onPost('/api/answerQuestion').reply(200, { wasCorrect: true });

const { getByTestId, getByText } = render(<MemoryRouter><Game/></MemoryRouter>);
const option1Button = getByTestId('Option1');
const nextButton = getByText('Next');

// Select an option
fireEvent.click(option1Button);

// Click the Next button
fireEvent.click(nextButton);

// Check if the navigation to the results page is triggered
expect(mock.history.post.length).toBe(1);
expect(mock.history.post[0].data).toBe(JSON.stringify({ questionId: 1, answerId: 1 }));
await waitFor(() => expect(getByText(/Round 2/i)).toBeInTheDocument());
});

test('handles next button click and continues to the next round', async () => {
// Mocking axios call
mock.onPost('/api/answerQuestion').reply(200, { wasCorrect: false });

const { getByTestId, getByText } = render(<MemoryRouter><Game/></MemoryRouter>);
const option1Button = getByTestId('Option1');
const nextButton = getByText('Next');

// Select an option
fireEvent.click(option1Button);

// Click the Next button
fireEvent.click(nextButton);

// Check if the game continues to the next round
expect(mock.history.post.length).toBe(1);
expect(mock.history.post[0].data).toBe(JSON.stringify({ questionId: 1, answerId: 1 }));
await waitFor(() => expect(getByText(/Round 2/i)).toBeInTheDocument());
});

test('selects the second option when clicked', () => {
const { getByTestId } = render(<MemoryRouter><Game/></MemoryRouter>);
test('renders ButtonEf component correctly', () => {
const { getByTestId } = render(
<MemoryRouter>
<Game/>
</MemoryRouter>
);
const option2Button = getByTestId('Option2');


// Assuming 'outline' variant is the default state
expect(option2Button).toHaveClass('chakra-button css-1vdwnhw');

// Simulate selecting the option
fireEvent.click(option2Button);


// Ensure the 'solid' variant is applied when the option is selected
expect(option2Button).toHaveClass('chakra-button custom-button effect1 css-1vdwnhw');
});
});
});