Skip to content

Commit

Permalink
Arreglados tests de calculadora
Browse files Browse the repository at this point in the history
  • Loading branch information
CANCI0 committed Apr 25, 2024
1 parent 7fe7869 commit 697122d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions webapp/src/pages/Calculadora/Calculadora.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test("renders the game screen", () => {
);

// Check if the game screen is rendered
expect(screen.getByText(/¿/i)).toBeInTheDocument();
expect(screen.getByText(/(\d+)\s*([-+*/])\s*(\d+)/i)).toBeInTheDocument();
expect(screen.getByTitle(/number/i)).toBeInTheDocument();
expect(screen.getByRole("button", { name: /enviar/i })).toBeInTheDocument();
expect(screen.getByText(/tiempo restante/i)).toBeInTheDocument();
Expand Down Expand Up @@ -43,7 +43,7 @@ test("handles correct answer", async () => {
var initialOperation = screen.getByText(
/(\d+)\s*([-+*/])\s*(\d+)/
).textContent;
initialOperation = initialOperation.substring(1, initialOperation.length - 1);
initialOperation = initialOperation.split("=")[0];

// Get the input field and submit button
const inputField = screen.getByTitle(/number/i);
Expand All @@ -64,7 +64,7 @@ test("handles correct answer", async () => {

// Get next operation
var nextOperation = screen.getByText(/(\d+)\s*([-+*/])\s*(\d+)/).textContent;
nextOperation = nextOperation.substring(1, nextOperation.length - 1);
nextOperation = nextOperation.split("=")[0];

// Enter the correct answer and submit
fireEvent.change(inputField, { target: { value: eval(nextOperation) } });
Expand Down

0 comments on commit 697122d

Please sign in to comment.