Skip to content

Commit

Permalink
chore(datastore): added unit tests for Amplify Api Native Bridge (#4983)
Browse files Browse the repository at this point in the history
* chore(datastore): added unit tests for Amplify Api Native Bridge

Unit tests for Query, Mutate, Subscribe, and Unsubscribe

* chore(datastore): updated Amplify Api Native Bridge unit tests per feedback

* chore(datastore): Formatted file
  • Loading branch information
tyllark authored Jun 7, 2024
1 parent 9c0d8fa commit 6be9898
Show file tree
Hide file tree
Showing 2 changed files with 998 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/amplify_datastore/lib/amplify_datastore.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class AmplifyDataStore extends DataStorePluginInterface
config.api?.awsPlugin?.all.entries.forEach((e) {
endpoints[e.key] = e.value.authorizationType.name;
});
final nativePlugin = _NativeAmplifyApi(authProviders);
final nativePlugin = NativeAmplifyApi(authProviders);
NativeApiPlugin.setup(nativePlugin);

final nativeBridge = NativeApiBridge();
Expand Down Expand Up @@ -292,10 +292,11 @@ class _NativeAmplifyAuthCognito
String get runtimeTypeName => '_NativeAmplifyAuthCognito';
}

class _NativeAmplifyApi
@visibleForTesting
class NativeAmplifyApi
with AWSDebuggable, AmplifyLoggerMixin
implements NativeApiPlugin {
_NativeAmplifyApi(this._authProviders);
NativeAmplifyApi(this._authProviders);

/// The registered [APIAuthProvider] instances.
final Map<APIAuthorizationType<AmplifyAuthProvider>, APIAuthProvider>
Expand All @@ -305,7 +306,7 @@ class _NativeAmplifyApi
_subscriptionsCache = {};

@override
String get runtimeTypeName => '_NativeAmplifyApi';
String get runtimeTypeName => 'NativeAmplifyApi';

@override
Future<String?> getLatestAuthToken(String providerName) {
Expand Down
Loading

0 comments on commit 6be9898

Please sign in to comment.