-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add testing for image subdomains, expected
i
and t
to be failed
- Loading branch information
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:dio/dio.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
// import 'package:concept_nhv/main.dart'; | ||
// import 'package:path/path.dart'; | ||
|
||
void main() { | ||
// testWidgets('Counter increments smoke test', (WidgetTester tester) async { | ||
// // Build our app and trigger a frame. | ||
// await tester.pumpWidget(const App()); | ||
|
||
// // Verify that our counter starts at 0. | ||
// expect(find.text('0'), findsOneWidget); | ||
// expect(find.text('1'), findsNothing); | ||
|
||
// // Tap the '+' icon and trigger a frame. | ||
// await tester.tap(find.byIcon(Icons.add)); | ||
// await tester.pump(); | ||
|
||
// // Verify that our counter has incremented. | ||
// expect(find.text('0'), findsNothing); | ||
// expect(find.text('1'), findsOneWidget); | ||
// }); | ||
|
||
var dio = Dio(BaseOptions( | ||
validateStatus: (status) { | ||
// code 404 is expected in the following test | ||
return status != null && status < 500; | ||
}, | ||
receiveTimeout: const Duration(seconds: 3), | ||
)); | ||
// recent comic mid, as of 20241223 | ||
var testmid = '3166275'; | ||
group('test image subdomain status with mid $testmid', () { | ||
var subdomain1 = ['t1', 't2', 't3', 't4', 't']; | ||
var subdomain2 = ['i1', 'i2', 'i3', 'i4', 'i']; | ||
|
||
for (var d in subdomain1) { | ||
var testdomain = "$d.nhentai.net"; | ||
var testurl = "https://$d.nhentai.net/galleries/$testmid/thumb.webp"; | ||
|
||
// test dns and http request | ||
test('test thumbnail subdomain $d', () { | ||
debugPrint('test $testurl'); | ||
expectLater(InternetAddress.lookup(testdomain), completion(isNotEmpty)); | ||
expectLater( | ||
dio.get(testurl), | ||
completion( | ||
predicate((Response response) { | ||
debugPrint('response code: ${response.statusCode}'); | ||
return response.statusCode == 200; | ||
}), | ||
), | ||
); | ||
}); | ||
} | ||
|
||
for (var d in subdomain2) { | ||
var testdomain = "$d.nhentai.net"; | ||
var testurl = "https://$d.nhentai.net/galleries/$testmid/1.webp"; | ||
|
||
// test dns and http request | ||
test('test inner page subdomain $d', () { | ||
debugPrint('test $testurl'); | ||
expectLater(InternetAddress.lookup(testdomain), completion(isNotEmpty)); | ||
expectLater( | ||
dio.get(testurl), | ||
completion( | ||
predicate((Response response) => response.statusCode == 200), | ||
), | ||
); | ||
}); | ||
} | ||
}); | ||
} |