Skip to content

Commit

Permalink
Merge branch 'test/application-new-tests' of https://github.com/fga-e…
Browse files Browse the repository at this point in the history
…ps-mds/2024-1-GEROcuidado-Front into test/application-new-tests
  • Loading branch information
sebazac332 committed Sep 20, 2024
2 parents db5e9b1 + f4ba75d commit 1f2dcec
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/app/__tests__/MaskHour.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,33 @@ describe("MaskInput", () => {
// Verifica se inputMaskChange foi chamado apenas com o primeiro dígito
expect(mockInputMaskChange).toHaveBeenCalledWith("19:");
});

test("chama inputMaskChange corretamente com valor inicial vazio", () => {
const { getByTestId } = render(
<MaskInput inputMaskChange={mockInputMaskChange} testID="mask-input" />
);

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

// Simula a mudança do texto para uma string vazia
fireEvent.changeText(input, "");

// Verifica se inputMaskChange foi chamado com uma string vazia
expect(mockInputMaskChange).toHaveBeenCalledWith("");
});

test("aplica a máscara parcialmente com dígito único", () => {
const { getByTestId } = render(
<MaskInput inputMaskChange={mockInputMaskChange} testID="mask-input" />
);

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

// Simula a mudança do texto com um único dígito
fireEvent.changeText(input, "1");

// Verifica se inputMaskChange foi chamado corretamente
expect(mockInputMaskChange).toHaveBeenCalledWith("1");
});

});

0 comments on commit 1f2dcec

Please sign in to comment.