diff --git a/violet/test/component_test.dart b/violet/test/component_test.dart index 7ba2822c4..50701ad3e 100644 --- a/violet/test/component_test.dart +++ b/violet/test/component_test.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:violet/component/eh/eh_headers.dart'; import 'package:violet/component/eh/eh_parser.dart'; import 'package:violet/component/hentai.dart'; import 'package:violet/database/query.dart'; @@ -61,4 +62,18 @@ Page 20: 020.jpg" src="https://exhentai.org/t/66/55/6655fb520e13eff74ebf9aa49c21 final provider = await HentaiManager.getImageProvider(query); expect(provider.length(), 25); }); + + test('EHentai Parse Article Data', () async { + final html = await EHSession.requestString( + 'https://exhentai.org/g/2504057/6757b3c4b8/'); + final article = EHParser.parseArticleData(html); + expect(article.comment!.isNotEmpty, true); + }); + + test('EHentai Get Images Url', () async { + final html = await EHSession.requestString( + 'https://exhentai.org/g/3176408/87646440e1/?p=0&inline_set=ts_m'); + final urls = EHParser.getImagesUrl(html); + expect(urls.length, 20); + }); } diff --git a/violet/test/parse_test.dart b/violet/test/parse_test.dart deleted file mode 100644 index a8294232a..000000000 --- a/violet/test/parse_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// This source code is a part of Project Violet. -// Copyright (C) 2020-2024. violet-team. Licensed under the Apache-2.0 License. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:http/http.dart' as http; -import 'package:violet/component/eh/eh_parser.dart'; - -void main() { - setUp(() async { - WidgetsFlutterBinding.ensureInitialized(); - }); - - test('Test Parse ExHentai', () async { - final html = (await http.get( - Uri.parse('https://exhentai.org/g/2504057/6757b3c4b8/'), - headers: { - 'Cookie': - 'ipb_member_id=2742770; ipb_pass_hash=622fcc2be82c922135bb0516e0ee497d; sk=t8inbzaqn45ttyn9f78eanzuqizh; igneous=rcrmcztqgf1v8p1e0' - })) - .body; - - expect(EHParser.parseArticleData(html).comment!.isNotEmpty, true); - }); -}