forked from eatvio/eatvio_app
feat(push_notifications): issue-660, fix: issue-908
This commit is contained in:
26
test/core/utils/url_utils_test.dart
Normal file
26
test/core/utils/url_utils_test.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
import 'package:eatvio_app/core/utils/url_utils.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
const baseUrl = 'https://dev2.eatvio.com';
|
||||
|
||||
test('keeps an absolute default avatar url unchanged', () {
|
||||
const avatar =
|
||||
'https://ui-avatars.dev2.eatvio.com/api/?name=%D0%9A+%D0%90&color=7F9CF5&background=EBF4FF';
|
||||
|
||||
expect(joinBaseUrl(baseUrl, avatar), avatar);
|
||||
});
|
||||
|
||||
test('keeps an absolute http url unchanged', () {
|
||||
const photo = 'http://localhost/storage/avatar.jpg';
|
||||
|
||||
expect(joinBaseUrl(baseUrl, photo), photo);
|
||||
});
|
||||
|
||||
test('prefixes a relative storage path with the base url', () {
|
||||
expect(
|
||||
joinBaseUrl(baseUrl, '/storage/profile-photos/photo.jpg'),
|
||||
'https://dev2.eatvio.com/storage/profile-photos/photo.jpg',
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user