Closed like-engels closed 1 year ago
Thanks for your patience here @like-engels; can you share an example test you're using here?
@stevehobbsdev sure!
Here's my code and impl.
Implementation class using a representable interface.
/// Auth0 Profile management provider for
/// managing Auth0 profiles
class Auth0ProfileManagementProvider extends ProfileManagementAdapter {
/// Auth0 Profile management provider for
/// managing Auth0 profiles
Auth0ProfileManagementProvider(this.auth0Instance);
/// Auth0 instance
final Auth0 auth0Instance;
@override
Future<void> changePassword(Map<String, dynamic> data) async {
try {
final email = data['email'] as String;
await auth0Instance.api.resetPassword(email: email, connection: 'Username-Password-Authentication');
} catch (error, stacktrace) {
return Future.error(error, stacktrace);
}
}
@override
Future<void> changeProfileInformation(Map<String, dynamic> profileInfo) async {
try {
await auth0Instance.api.userProfile(accessToken: profileInfo['userInfo'] as String);
} catch (error, stacktrace) {
return Future.error(error, stacktrace);
}
}
@override
Future<void> otpLogin(String otp, String mfaToken) async {
try {
await auth0Instance.api.loginWithOtp(otp: otp, mfaToken: mfaToken);
} catch (error, stacktrace) {
return Future.error(error, stacktrace);
}
}
}
The test itself
void main() {
test('test check', () async {
WidgetsFlutterBinding.ensureInitialized();
final provider = Auth0ProfileManagementProvider(
Auth0('tenancyrul',
'apptoken',
),
);
await provider.changePassword({
'email': 'someemail@example.com'
});
});
}
Hi @like-engels, apologies for the delay here.
This library should be considered as a black box and mocked when unit-testing, to avoid doing integration tests of third-party libraries in your unit tests.
Closing, as I believe the above answers your question. Please feel free to ping if you'd prefer to reopen.
Checklist
Description
MissingPluginException(No implementation found for method auth#resetPassword on channel auth0.com/auth0_flutter/auth) package:flutter/src/services/platform_channel.dart 308:7 MethodChannel._invokeMethod ===== asynchronous gap =========================== dart:async new Future.error
Reproduction
auth0_flutter version
latest
Flutter version
3.10.0
Platform
Android, iOS
Platform version(s)
13,16