mirror of
https://github.com/hanskokx/arcane_framework.git
synced 2026-08-12 06:10:55 +02:00
0078e344fd
* Update Logging feature to replace @LoggingFeature annotation with LoggerName mixin for runtime accessibility Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> * Bump version to 2.0.2 in pubspec.yaml and update CHANGELOG to reflect the new version Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> * Add migration steps for replacing @LoggingFeature annotation with LoggerName mixin in CHANGELOG Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> * Fix class declaration in migration example for LoggerName mixin Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> * Enhance CI workflow, coverage enforcement, and environment tests (#10) * Enhance CI workflow and coverage enforcement; update tests and add new environment tests Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> * Revert version bump in pubspec.yaml and remove test coverage note from CHANGELOG Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> * Update test to expect a thrown exception when no interfaces are registered Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> * Add ArcaneEnvironmentModeController and related tests for debug mode management Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> * Refactor theme switcher tests to use platform dispatcher for brightness change simulation Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> --------- Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> * refactor(api): Remove export of Error and Ok from result_monad (#11) The `Error` and `Ok` symbols from the `result_monad` package are no longer re-exported directly by `arcane_framework`. Consumers needing these symbols must now explicitly import them from `package:result_monad`. This clarifies dependency ownership and reduces `arcane_framework`'s public API surface. --------- Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
82 lines
1.9 KiB
Dart
82 lines
1.9 KiB
Dart
import "package:arcane_framework/src/services/authentication/authentication_service.dart";
|
|
import "package:flutter_test/flutter_test.dart";
|
|
import "package:result_monad/result_monad.dart";
|
|
|
|
class MockAuth implements ArcaneAuthInterface {
|
|
@override
|
|
Future<Result<void, String>> login<T>({
|
|
T? input,
|
|
Future<void> Function()? onLoggedIn,
|
|
}) async {
|
|
if (onLoggedIn != null) await onLoggedIn();
|
|
return const Result.ok(null);
|
|
}
|
|
|
|
@override
|
|
Future<bool> get isSignedIn => Future.value(true);
|
|
|
|
@override
|
|
Future<String?>? get accessToken => Future.value("token");
|
|
|
|
@override
|
|
Future<String?>? get refreshToken => Future.value("refresh");
|
|
|
|
@override
|
|
Future<void> init() async {}
|
|
|
|
@override
|
|
Future<Result<void, String>> logout({
|
|
Future<void> Function()? onLoggedOut,
|
|
}) async {
|
|
if (onLoggedOut != null) await onLoggedOut();
|
|
return const Result.ok(null);
|
|
}
|
|
}
|
|
|
|
class MinimalAuth extends ArcaneAuthInterface {
|
|
@override
|
|
Future<bool> get isSignedIn => Future.value(false);
|
|
|
|
@override
|
|
Future<String?>? get accessToken => Future.value(null);
|
|
|
|
@override
|
|
Future<String?>? get refreshToken => Future.value(null);
|
|
|
|
@override
|
|
Future<Result<void, String>> login<T>({
|
|
T? input,
|
|
Future<void> Function()? onLoggedIn,
|
|
}) async {
|
|
return const Result.ok(null);
|
|
}
|
|
|
|
@override
|
|
Future<Result<void, String>> logout({
|
|
Future<void> Function()? onLoggedOut,
|
|
}) async {
|
|
return const Result.ok(null);
|
|
}
|
|
}
|
|
|
|
void main() {
|
|
test("MockAuth fulfills ArcaneAuthInterface contract", () async {
|
|
final auth = MockAuth();
|
|
expect(await auth.isSignedIn, isTrue);
|
|
expect(await auth.accessToken, "token");
|
|
expect(await auth.refreshToken, "refresh");
|
|
var called = false;
|
|
await auth.logout(
|
|
onLoggedOut: () async {
|
|
called = true;
|
|
},
|
|
);
|
|
expect(called, isTrue);
|
|
});
|
|
|
|
test("default init implementation completes", () async {
|
|
final auth = MinimalAuth();
|
|
await auth.init();
|
|
});
|
|
}
|