Files

25 lines
797 B
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:moonwell_launcher/features/launcher/data/launcher_news_link.dart';
void main() {
test('builds public news URL from launcher base URL and news id', () {
expect(
buildLauncherNewsUri('http://localhost:8080', 4),
Uri.parse('http://localhost:8080/news/4'),
);
});
test('preserves a base URL path when building news URL', () {
expect(
buildLauncherNewsUri('https://example.com/moonwell', 7),
Uri.parse('https://example.com/moonwell/news/7'),
);
});
test('rejects invalid base URLs and news ids', () {
expect(buildLauncherNewsUri('', 4), isNull);
expect(buildLauncherNewsUri('not-a-url', 4), isNull);
expect(buildLauncherNewsUri('https://example.com', 0), isNull);
});
}