1
0
mirror of https://github.com/h7x4/unofficial_jisho_api_dart.git synced 2025-09-21 04:55:56 +02:00

Some debugging

This commit is contained in:
2020-04-21 22:36:26 +02:00
parent 7157bd1d73
commit 9394d7ea2e
4 changed files with 156 additions and 31 deletions

View File

@@ -3,6 +3,7 @@ import 'package:path/path.dart' as path;
import 'dart:convert';
import 'package:unofficial_jisho_api/unofficial_jisho_api.dart';
import 'local_function_test_cases.dart' show test_local_functions;
import 'package:test/test.dart';
final jisho = JishoApi();
@@ -21,7 +22,7 @@ void runTestCases(List<String> testCaseFiles, String apiFunction) async {
switch(apiFunction) {
case 'searchForKanji': {
final result = await jisho.searchForKanji(testCase['query']);
expect(result, testCase['expectedResult']);
expect(result, jsonDecode(testCase['expectedResult']));
break;
}
case 'searchForExamples': {
@@ -42,6 +43,8 @@ void runTestCases(List<String> testCaseFiles, String apiFunction) async {
void main() async {
await test_local_functions();
await runTestCases(getFilePaths('kanji_test_cases'), 'searchForKanji');
await runTestCases(getFilePaths('example_test_cases'), 'searchForExamples');