Created
February 7, 2020 13:59
-
-
Save OleksandrKucherenko/f71a81b0420b3306c03ddc3051b2e73f 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.P) | |
public void testFingerprintConfigured_api28() throws Exception { | |
// GIVEN: | |
// API28 android version | |
// for api24+ system feature should be enabled | |
// fingerprints are configured | |
ReactApplicationContext context = getRNContext(); | |
shadowOf(context.getPackageManager()).setSystemFeature(PackageManager.FEATURE_FINGERPRINT, true); | |
// 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: verify availability | |
final int result = BiometricManager.from(context).canAuthenticate(); | |
final KeychainModule module = new KeychainModule(context); | |
final boolean isFingerprintWorking = module.isFingerprintAuthAvailable(); | |
// THEN: biometrics 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