From 968da11bec7773d3b5f305169309ecdfd5f45751 Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Sun, 25 Aug 2024 06:58:41 +0700 Subject: [PATCH] Create biometricAuth.test.js --- app/tests/unit_test/biometricAuth.test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 app/tests/unit_test/biometricAuth.test.js diff --git a/app/tests/unit_test/biometricAuth.test.js b/app/tests/unit_test/biometricAuth.test.js new file mode 100644 index 0000000..e19eaef --- /dev/null +++ b/app/tests/unit_test/biometricAuth.test.js @@ -0,0 +1,18 @@ +import React from 'react'; +import { render, fireEvent } from '@testing-library/react-native'; +import BiometricAuth from './BiometricAuth'; + +describe('BiometricAuth', () => { + it('renders correctly', () => { + const { getByText } = render(); + expect(getByText('Authenticate with Biometrics')).toBeTruthy(); + }); + + it('calls onAuthenticate when button is pressed', () => { + const onAuthenticate = jest.fn(); + const { getByText } = render(); + const button = getByText('Authenticate'); + fireEvent.press(button); + expect(onAuthenticate).toHaveBeenCalledTimes(1); + }); +});