Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ environment:
sdk: '>=2.12.0 <3.0.0'

dependencies:
http: ^0.13.3
string_validator: ^0.3.0
html: ^0.15.0
http: ^1.0.0
string_validator: ^1.0.0
html: ^0.15.4

dev_dependencies:
pedantic: ^1.11.0
test: ^1.17.5
pedantic: ^1.11.1
test: ^1.24.3
10 changes: 4 additions & 6 deletions test/metadata_fetch_test.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'package:metadata_fetch/metadata_fetch.dart';
import 'package:html/parser.dart' as html;
import 'package:http/http.dart' as http;
import 'package:metadata_fetch/src/parsers/jsonld_parser.dart';
import 'package:metadata_fetch/src/parsers/parsers.dart';
import 'package:test/test.dart';

// TODO: Use a Mock Server for testing
Expand Down Expand Up @@ -110,7 +108,7 @@ void main() {
Metadata data = OpenGraphParser(document).parse();
expect(data.title, 'Drake - When To Say When & Chicago Freestyle');
expect(
data.image, 'https://i.ytimg.com/vi/0jz0GAFNNIo/maxresdefault.jpg');
data.image?.split('?').first, 'https://i.ytimg.com/vi/0jz0GAFNNIo/maxresdefault.jpg');
});

test('TwitterCard Parser', () async {
Expand Down Expand Up @@ -152,7 +150,7 @@ void main() {
print(data?.description);
print(data?.url);
expect(data?.toMap().isEmpty, false);
expect(data?.url, url + "/");
expect(data?.url, url.replaceAll('https:', '') + "/");
});

test('FB Test', () async {
Expand All @@ -165,7 +163,7 @@ void main() {
'https://www.youtube.com/watch?v=0jz0GAFNNIo');
expect(data?.title, 'Drake - When To Say When & Chicago Freestyle');
expect(
data?.image, 'https://i.ytimg.com/vi/0jz0GAFNNIo/maxresdefault.jpg');
data?.image?.split('?').first, 'https://i.ytimg.com/vi/0jz0GAFNNIo/maxresdefault.jpg');
});

test('Unicode Test', () async {
Expand All @@ -176,7 +174,7 @@ void main() {
test('Gooogle Test', () async {
final data = await MetadataFetch.extract('https://google.ca');
expect(data?.toMap().isEmpty, false);
expect(data?.title, 'google');
expect(data?.title, 'Google');
});

test('Invalid Url Test', () async {
Expand Down