Skip to content

Commit

Permalink
Create biometricAuth.test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 24, 2024
1 parent 23ad4a7 commit 968da11
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/tests/unit_test/biometricAuth.test.js
Original file line number Diff line number Diff line change
@@ -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(<BiometricAuth />);
expect(getByText('Authenticate with Biometrics')).toBeTruthy();
});

it('calls onAuthenticate when button is pressed', () => {
const onAuthenticate = jest.fn();
const { getByText } = render(<BiometricAuth onAuthenticate={onAuthenticate} />);
const button = getByText('Authenticate');
fireEvent.press(button);
expect(onAuthenticate).toHaveBeenCalledTimes(1);
});
});

0 comments on commit 968da11

Please sign in to comment.