From 00418cb8235fb5a7c68b0273f5cbb2139520a0c2 Mon Sep 17 00:00:00 2001 From: Gabriel <gabrielmonteiro1203@gmail.com> Date: Thu, 19 Sep 2024 23:04:01 -0300 Subject: [PATCH] test: test to allow correct sequence without changes Co-Authored-By: Natalia Rodrigues <Natytotherodrigues@gmail.com> --- src/app/__tests__/MaskHour.spec.tsx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/app/__tests__/MaskHour.spec.tsx b/src/app/__tests__/MaskHour.spec.tsx index a3b5bc5a..b5dd0e11 100644 --- a/src/app/__tests__/MaskHour.spec.tsx +++ b/src/app/__tests__/MaskHour.spec.tsx @@ -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"); + }); }); \ No newline at end of file