mirror of
https://github.com/mihonapp/mihon.git
synced 2025-07-13 11:15:11 +02:00
Separate method pullImageUrlsFromNetwork to allow testing
This commit is contained in:
@ -2,6 +2,8 @@ package eu.kanade.mangafeed;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@ -9,10 +11,15 @@ import org.robolectric.RobolectricGradleTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import eu.kanade.mangafeed.data.caches.CacheManager;
|
||||
import eu.kanade.mangafeed.data.helpers.NetworkHelper;
|
||||
import eu.kanade.mangafeed.data.models.Manga;
|
||||
import eu.kanade.mangafeed.sources.Batoto;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.observers.TestSubscriber;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
@Config(constants = BuildConfig.class, sdk = Build.VERSION_CODES.LOLLIPOP)
|
||||
@RunWith(RobolectricGradleTestRunner.class)
|
||||
@ -32,9 +39,17 @@ public class BatotoTest {
|
||||
|
||||
@Test
|
||||
public void testImageList() {
|
||||
TestSubscriber a = new TestSubscriber();
|
||||
List<String> imageUrls = b.getImageUrlsFromNetwork(chapterUrl)
|
||||
.toList().toBlocking().single();
|
||||
|
||||
b.pullImageUrlsFromNetwork(chapterUrl).subscribe(a);
|
||||
a.assertNoErrors();
|
||||
Assert.assertTrue(imageUrls.size() > 5);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMangaList() {
|
||||
List<Manga> mangaList = b.pullPopularMangasFromNetwork(1)
|
||||
.toBlocking().first();
|
||||
|
||||
Assert.assertTrue(mangaList.size() > 25);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user