Created
February 7, 2020 13:57
-
-
Save OleksandrKucherenko/740c191a3f1e95d2e5f20516f101787a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
@Config(sdk = Build.VERSION_CODES.M) | |
public void testFingerprintConfigured_api23() throws Exception { | |
// GIVEN: | |
// API23 android version | |
// Fingerprints are configured | |
// fingerprint feature is ignored by android os | |
ReactApplicationContext context = getRNContext(); | |
// set that hardware is available | |
FingerprintManager fm = (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE); | |
shadowOf(fm).setIsHardwareDetected(true); | |
shadowOf(fm).setDefaultFingerprints(5); // 5 fingerprints are available | |
// WHEN: check availability | |
final int result = BiometricManager.from(context).canAuthenticate(); | |
final KeychainModule module = new KeychainModule(context); | |
final boolean isFingerprintWorking = module.isFingerprintAuthAvailable(); | |
// THEN: biometric works | |
assertThat(result, is(BiometricManager.BIOMETRIC_SUCCESS)); | |
assertThat(isFingerprintWorking, is(true)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment