правки по лаунчеру
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user