Added som local function tests
This commit is contained in:
parent
9394d7ea2e
commit
a1a99a90dd
|
@ -197,7 +197,7 @@ String getGifUri(String kanji) {
|
||||||
|
|
||||||
int getNewspaperFrequencyRank(String pageHtml) {
|
int getNewspaperFrequencyRank(String pageHtml) {
|
||||||
final frequencySection = getStringBetweenStrings(pageHtml, '<div class="frequency">', '</div>');
|
final frequencySection = getStringBetweenStrings(pageHtml, '<div class="frequency">', '</div>');
|
||||||
return frequencySection ?? int.parse(getStringBetweenStrings(frequencySection, '<strong>', '</strong>'));
|
return frequencySection.isNotEmpty ? int.parse(getStringBetweenStrings(frequencySection, '<strong>', '</strong>')) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
KanjiResult parseKanjiPageData(String pageHtml, String kanji) {
|
KanjiResult parseKanjiPageData(String pageHtml, String kanji) {
|
||||||
|
|
|
@ -91,23 +91,28 @@ void test_local_functions() async {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getRadical', () {
|
test('getRadical', () {
|
||||||
|
final result = getRadical(kanjiPage);
|
||||||
|
expect(result, ['ジ']); //FIX
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getParts', () {
|
test('getParts', () {
|
||||||
|
final result = getParts(kanjiPage);
|
||||||
|
expect(result, ['土', '寸', '日']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getSvgUri', () {
|
test('getSvgUri', () {
|
||||||
|
final result = getSvgUri(kanjiPage);
|
||||||
|
expect(result, 'http://d1w6u4xc3l95km.cloudfront.net/kanji-2015-03/06642.svg');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getGifUri', () {
|
test('getGifUri', () {
|
||||||
|
final result = getGifUri(kanjiPage);
|
||||||
|
expect(result, 'https://raw.githubusercontent.com/mistval/kanji_images/master/gifs/3c.gif');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getNewspaperFrequencyRank', () {
|
test('getNewspaperFrequencyRank', () {
|
||||||
|
final result = getNewspaperFrequencyRank(kanjiPage);
|
||||||
|
expect(result, 16); //This might change
|
||||||
});
|
});
|
||||||
|
|
||||||
test('parseKanjiPageData', () {
|
test('parseKanjiPageData', () {
|
||||||
|
|
Loading…
Reference in New Issue