mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-10 20:27:15 +01:00
Compile-time dart-define that prefixes every RTDB path with sandbox/<slot>; invalid values throw at startup. Empty keeps prod paths unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
32 lines
988 B
Dart
32 lines
988 B
Dart
// Helper for test/sync_namespace_test.dart: the SYNC_NAMESPACE define is
|
|
// compile-time, so the test runs this in a fresh process with -D set. It signs
|
|
// in from an in-memory session (no network) and prints the first request path.
|
|
import 'package:crdt_sync/crdt_sync.dart';
|
|
import 'package:http/http.dart' as http;
|
|
import 'package:http/testing.dart' as http_testing;
|
|
|
|
Future<void> main() async {
|
|
final mock = http_testing.MockClient((request) async {
|
|
print(request.url.path);
|
|
return http.Response('null', 200);
|
|
});
|
|
final client = await firebaseClientFor(
|
|
config: const FirebaseConfig(
|
|
apiKey: 'k',
|
|
databaseUrl: 'https://example.firebasedatabase.app',
|
|
projectId: 'p',
|
|
uid: 'u',
|
|
email: 'e@x.y',
|
|
),
|
|
store: InMemoryCredentialStore(
|
|
FirebaseCredentials(
|
|
idToken: 'i',
|
|
refreshToken: 'r',
|
|
expiresAt: DateTime.utc(2099),
|
|
),
|
|
),
|
|
httpClient: mock,
|
|
);
|
|
await client.listDirectory('devices');
|
|
}
|