fix onyl pyx.li JPG through parsing of website, as added imgbb.com provider in same way.
This commit is contained in:
1 parent
55529c3a61
commit
b137dd8fe1
2 files changed
+63
-21
No files matched your search
@@ -3,8 +3,8 @@ import 'package:meshcore_open/helpers/message_image_helper.dart';
|
||||
|
||||
void main() {
|
||||
group('MessageImageHelper', () {
|
||||
test('parses short pyx ids', () {
|
||||
final attachment = MessageImageHelper.parse(
|
||||
test('parses short pyx ids', () async {
|
||||
final attachment = await MessageImageHelper.parse(
|
||||
'my picture: https://pyx.li/?i=RzmdkTsE text',
|
||||
);
|
||||
|
||||
@@ -12,15 +12,17 @@ void main() {
|
||||
expect(attachment, 'https://pyx.li/i/RzmdkTsE.jpg');
|
||||
});
|
||||
|
||||
test('parses direct pyx image urls', () {
|
||||
final attachment = MessageImageHelper.parse('https://pyx.li/?i=Cd1KFiwu');
|
||||
test('parses direct pyx image urls', () async {
|
||||
final attachment = await MessageImageHelper.parse(
|
||||
'https://pyx.li/?i=Cd1KFiwu',
|
||||
);
|
||||
|
||||
expect(attachment, isNotNull);
|
||||
expect(attachment, 'https://pyx.li/i/Cd1KFiwu.jpg');
|
||||
});
|
||||
|
||||
test('parses provider-hosted ipfs links', () {
|
||||
final attachment = MessageImageHelper.parse(
|
||||
test('parses provider-hosted ipfs links', () async {
|
||||
final attachment = await MessageImageHelper.parse(
|
||||
'my picture: https://uneven-plum-tarantula.myfilebase.com/ipfs/bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly text',
|
||||
);
|
||||
|
||||
@@ -31,8 +33,8 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('parses direct ipfs cid urls', () {
|
||||
final attachment = MessageImageHelper.parse(
|
||||
test('parses direct ipfs cid urls', () async {
|
||||
final attachment = await MessageImageHelper.parse(
|
||||
'my picture: ipfs://bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly text',
|
||||
);
|
||||
|
||||
@@ -43,8 +45,8 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('parses http image urls', () {
|
||||
final attachment = MessageImageHelper.parse(
|
||||
test('parses http image urls', () async {
|
||||
final attachment = await MessageImageHelper.parse(
|
||||
'see this image https://example.com/picture.png?size=large additional text',
|
||||
);
|
||||
|
||||
@@ -52,8 +54,8 @@ void main() {
|
||||
expect(attachment, 'https://example.com/picture.png?size=large');
|
||||
});
|
||||
|
||||
test('returns null for plain text', () {
|
||||
expect(MessageImageHelper.parse('hello world'), isNull);
|
||||
test('returns null for plain text', () async {
|
||||
expect(await MessageImageHelper.parse('hello world'), isNull);
|
||||
});
|
||||
|
||||
test('returns null for non-image ipfs gateway url', () async {
|
||||
|
||||
Reference in new issue
Block a user