mirror of
https://github.com/FoggedLens/deflock-app.git
synced 2026-07-19 18:47:49 +02:00
feat: add node deep link handling to DeepLinkService
Adds `deflockapp://node?id=<nodeId>` deep link support: parses the node ID, fetches the OSM node via the public API, and delivers it via an `onNodeDeepLink` callback for HomeScreen to register. Includes URL parsing unit tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
committed by
Claude Code
parent
8aab359f22
commit
74d8214dda
@@ -0,0 +1,26 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('Node deep link URL parsing', () {
|
||||
test('extracts node ID from valid link', () {
|
||||
final uri = Uri.parse('deflockapp://node?id=1234567890');
|
||||
expect(uri.host, 'node');
|
||||
expect(uri.queryParameters['id'], '1234567890');
|
||||
});
|
||||
|
||||
test('returns null for missing id param', () {
|
||||
final uri = Uri.parse('deflockapp://node');
|
||||
expect(uri.queryParameters['id'], isNull);
|
||||
});
|
||||
|
||||
test('returns null for empty id param', () {
|
||||
final uri = Uri.parse('deflockapp://node?id=');
|
||||
expect(uri.queryParameters['id'], '');
|
||||
});
|
||||
|
||||
test('returns null for non-numeric id', () {
|
||||
final uri = Uri.parse('deflockapp://node?id=abc');
|
||||
expect(int.tryParse(uri.queryParameters['id'] ?? ''), isNull);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user