mirror of
https://github.com/h7x4/unofficial_jisho_api_dart.git
synced 2025-09-21 04:55:56 +02:00
Fix some bugs
This commit is contained in:
@@ -17,20 +17,20 @@ void test_local_functions() async {
|
||||
|
||||
test('uriForKanjiSearch', () {
|
||||
final result = uriForKanjiSearch('時');
|
||||
expect(result, 'https://jisho.org/search/%E6%99%82%23kanji');
|
||||
expect(result, 'http://jisho.org/search/%E6%99%82%23kanji');
|
||||
});
|
||||
|
||||
test('getUriForStrokeOrderDiagram', () {
|
||||
final result = getUriForStrokeOrderDiagram('時');
|
||||
expect(result, 'https://classic.jisho.org/static/images/stroke_diagrams/26178_frames.png');
|
||||
expect(result, 'http://classic.jisho.org/static/images/stroke_diagrams/26178_frames.png');
|
||||
});
|
||||
|
||||
test('uriForPhraseSearch', () {
|
||||
final result = uriForPhraseSearch('時間');
|
||||
expect(result, 'https://jisho.org/api/v1/search/words?keyword=%E6%99%82%E9%96%93');
|
||||
expect(result, 'http://jisho.org/api/v1/search/words?keyword=%E6%99%82%E9%96%93');
|
||||
});
|
||||
|
||||
final kanjiPage = (await http.get('https://jisho.org/search/%E6%99%82%23kanji')).body;
|
||||
final kanjiPage = (await http.get('http://jisho.org/search/%E6%99%82%23kanji')).body;
|
||||
|
||||
test('containsKanjiGlyph', () {
|
||||
final result = containsKanjiGlyph(kanjiPage, '時');
|
||||
@@ -277,10 +277,10 @@ void test_local_functions() async {
|
||||
meaning: 'sun, day'
|
||||
);
|
||||
expectedResult.parts = ['土', '寸', '日'];
|
||||
expectedResult.strokeOrderDiagramUri = 'https://classic.jisho.org/static/images/stroke_diagrams/26178_frames.png';
|
||||
expectedResult.strokeOrderDiagramUri = 'http://classic.jisho.org/static/images/stroke_diagrams/26178_frames.png';
|
||||
expectedResult.strokeOrderSvgUri = 'http://d1w6u4xc3l95km.cloudfront.net/kanji-2015-03/06642.svg';
|
||||
expectedResult.strokeOrderGifUri = 'https://raw.githubusercontent.com/mistval/kanji_images/master/gifs/3c.gif';
|
||||
expectedResult.uri = 'https://jisho.org/search/%E6%99%82%23kanji';
|
||||
expectedResult.strokeOrderGifUri = 'https://raw.githubusercontent.com/mistval/kanji_images/master/gifs/6642.gif';
|
||||
expectedResult.uri = 'http://jisho.org/search/%E6%99%82%23kanji';
|
||||
|
||||
expect(
|
||||
json.encode(result),
|
||||
|
@@ -22,7 +22,7 @@ void runTestCases(List<String> testCaseFiles, String apiFunction) async {
|
||||
switch(apiFunction) {
|
||||
case 'searchForKanji': {
|
||||
final result = await jisho.searchForKanji(testCase['query']);
|
||||
expect(result, jsonDecode(testCase['expectedResult']));
|
||||
expect(result.toJson(), testCase['expectedResult']);
|
||||
break;
|
||||
}
|
||||
case 'searchForExamples': {
|
||||
|
Reference in New Issue
Block a user