Skip to content

Commit 1198b21

Browse files
TobiGrthat1potato
authored andcommitted
[SoundCloud] Add test to check that next pages are not empty for tabs
1 parent d7a575a commit 1198b21

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelTabExtractorTest.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
package org.schabi.newpipe.extractor.services.soundcloud;
22

3+
import static org.junit.jupiter.api.Assertions.assertFalse;
4+
import static org.junit.jupiter.api.Assertions.assertTrue;
5+
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertEmptyErrors;
36
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
47
import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestGetPageInNewExtractor;
58

69
import org.junit.jupiter.api.Test;
710
import org.schabi.newpipe.extractor.InfoItem;
11+
import org.schabi.newpipe.extractor.ListExtractor;
812
import org.schabi.newpipe.extractor.StreamingService;
913
import org.schabi.newpipe.extractor.channel.tabs.ChannelTabExtractor;
1014
import org.schabi.newpipe.extractor.channel.tabs.ChannelTabs;
1115
import org.schabi.newpipe.extractor.services.DefaultListExtractorTest;
1216

17+
import java.util.List;
18+
1319
class SoundcloudChannelTabExtractorTest {
1420

1521
static class Tracks extends DefaultListExtractorTest<ChannelTabExtractor> {
@@ -88,4 +94,30 @@ protected ChannelTabExtractor createExtractor() throws Exception {
8894
@Override public String expectedOriginalUrlContains() throws Exception { return "https://soundcloud.com/soreen-735855039/likes"; }
8995
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.PLAYLIST; }
9096
}
97+
98+
static class NoEmptyNextPages extends DefaultListExtractorTest<ChannelTabExtractor> {
99+
@Override
100+
protected ChannelTabExtractor createExtractor() throws Exception {
101+
return SoundCloud.getChannelTabExtractorFromId("73637815", ChannelTabs.TRACKS);
102+
}
103+
104+
@Override public StreamingService expectedService() throws Exception { return SoundCloud; }
105+
@Override public String expectedName() throws Exception { return ChannelTabs.TRACKS; }
106+
@Override public String expectedId() throws Exception { return "73637815"; }
107+
@Override public String expectedUrlContains() throws Exception { return "https://soundcloud.com/hurtbox/tracks"; }
108+
@Override public String expectedOriginalUrlContains() throws Exception { return "https://soundcloud.com/hurtbox/tracks"; }
109+
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.STREAM; }
110+
111+
@Test
112+
public void testNextPages() throws Exception {
113+
ListExtractor.InfoItemsPage<InfoItem> page = extractor().getInitialPage();
114+
for (int i = 1; i <= 5; i++) {
115+
assertEmptyErrors("Next page has errors", page.getErrors());
116+
assertFalse(page.getItems().isEmpty(), "Next page is empty");
117+
assertTrue(page.hasNextPage(), "Next page does not have more items");
118+
page = extractor().getPage(page.getNextPage());
119+
}
120+
}
121+
122+
}
91123
}

0 commit comments

Comments
 (0)