Skip to content

Commit

Permalink
test: test to allow correct sequence without changes
Browse files Browse the repository at this point in the history
Co-Authored-By: Natalia Rodrigues <Natytotherodrigues@gmail.com>
  • Loading branch information
GabrielSMonteiro and Natyrodrigues committed Sep 20, 2024
1 parent f4ba75d commit 00418cb
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/app/__tests__/MaskHour.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,23 @@ describe("MaskInput", () => {
expect(mockInputMaskChange).toHaveBeenCalledWith("1");
});

test("permite uma sequência correta sem alterações", () => {
const { getByTestId } = render(
<MaskInput inputMaskChange={mockInputMaskChange} testID="mask-input" />
);

const input = getByTestId("mask-input");

// Simula a mudança do texto para "12:34"
fireEvent.changeText(input, "1234");

// Verifica se inputMaskChange foi chamado corretamente
expect(mockInputMaskChange).toHaveBeenCalledWith("12:34");

// Simula a mudança do texto para "12:34" novamente
fireEvent.changeText(input, "1234");

// Verifica se inputMaskChange foi chamado novamente com o mesmo valor
expect(mockInputMaskChange).toHaveBeenCalledWith("12:34");
  });
});

0 comments on commit 00418cb

Please sign in to comment.