1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-12 17:57:29 +00:00

intent test cases for #1201

This commit is contained in:
Austin Huang 2021-05-18 18:09:40 -04:00
parent 5c0598502a
commit 65addf8c92
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
2 changed files with 26 additions and 10 deletions

View File

@ -51,8 +51,6 @@
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="ig.me" />
<data android:host="www.ig.me" />
<data android:host="instagr.am" />
<data android:host="www.instagr.am" />
<data android:host="instagram.com" />
@ -60,6 +58,7 @@
<data android:pathPrefix="/" />
<data android:pathPrefix="/p" />
<data android:pathPrefix="/explore/tags" />
<data android:pathPrefix="/explore/locations" />
</intent-filter>
</activity>
<activity
@ -104,14 +103,6 @@
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="ig.me" />
<data android:scheme="http" />
<data android:scheme="https" />
</intent-filter>
</activity>
<activity
android:name=".activities.Login"

View File

@ -0,0 +1,25 @@
package awais.instagrabber.utils;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import awais.instagrabber.models.IntentModel;
import awais.instagrabber.models.enums.IntentModelType;
class IntentUtilsTest {
@Test
void getIntentFromUrl() {
IntentModel intent = IntentUtils.parseUrl("https://instagr.am/austinhuang.me");
Assertions.assertEquals(new IntentModel(IntentModelType.USERNAME, "austinhuang.me"), intent);
intent = IntentUtils.parseUrl("https://www.instagr.am/_u/austinhuang.me");
Assertions.assertEquals(new IntentModel(IntentModelType.USERNAME, "austinhuang.me"), intent);
intent = IntentUtils.parseUrl("https://instagram.com/p/BmjKdkxjzO7/");
Assertions.assertEquals(new IntentModel(IntentModelType.POST, "BmjKdkxjzO7"), intent);
intent = IntentUtils.parseUrl("https://www.instagram.com/explore/tags/metrodemontreal/");
Assertions.assertEquals(new IntentModel(IntentModelType.HASHTAG, "metrodemontreal"), intent);
intent = IntentUtils.parseUrl("http://www.instagram.com/explore/locations/538444610/abcde");
Assertions.assertEquals(new IntentModel(IntentModelType.LOCATION, "538444610"), intent);
// todo: reel and igtv test cases that are sfw and preferably n i c e
}
}