Skip to content

Commit

Permalink
feat: added integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vikram Kalta authored and Vikram Kalta committed Oct 8, 2024
1 parent 5fe94a8 commit 8b85986
Show file tree
Hide file tree
Showing 7 changed files with 647 additions and 576 deletions.
2 changes: 2 additions & 0 deletions contentstack/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:core:1.5.0'
testImplementation 'org.robolectric:robolectric:4.6.1'

androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,6 @@ public static void oneTimeSetUp() throws Exception {
stack = Contentstack.stack(appContext, DEFAULT_API_KEY, DEFAULT_DELIVERY_TOKEN, DEFAULT_ENV, config);
}


@Test()
public void test_A_getAllAssetsToSetAssetUID() {
final AssetLibrary assetLibrary = stack.assetLibrary();
assetLibrary.fetchAll(new FetchAssetsCallback() {
@Override
public void onCompletion(ResponseType responseType, List<Asset> assets, Error error) {
if (error == null) {
Log.d(TAG, "response: " + assets.get(0).getAssetUid());
assetUid = assets.get(0).getAssetUid();
Log.e(assetUid, assetUid);
}
}
});

}

@Test
public void test_B_VerifyAssetUID() {
final Asset asset = stack.asset(assetUid);
Expand Down Expand Up @@ -89,28 +72,6 @@ public void onCompletion(ResponseType responseType, Error error) {
});
}

@Test
public void test_D_AssetLibrary_fetch() {
final AssetLibrary assetLibrary = stack.assetLibrary();
assetLibrary.fetchAll(new FetchAssetsCallback() {
@Override
public void onCompletion(ResponseType responseType, List<Asset> assets, Error error) {
if (error == null) {
assets.forEach(asset -> {
Log.d(TAG, "----Test--Asset-D--Success----" + asset.toJSON());
Log.d(TAG, "----Test--Asset-D--Success----" + asset.getFileType());
Log.d(TAG, "----Test--Asset-D--Success----" + asset.getCreatedBy());
Log.d(TAG, "----Test--Asset-D--Success----" + asset.getUpdatedBy());
Log.d(TAG, "----Test--Asset-D--Success----" + asset.getFileName());
Log.d(TAG, "----Test--Asset-D--Success----" + asset.getFileSize());
Log.d(TAG, "----Test--Asset-D--Success----" + asset.getAssetUid());
Log.d(TAG, "----Test--Asset-D--Success----" + asset.getUrl());
});
}
}
});
}

@Test
public void test_E_AssetLibrary_includeCount_fetch() {
final AssetLibrary assetLibrary = stack.assetLibrary();
Expand Down Expand Up @@ -195,21 +156,6 @@ public void test_GCP_NA() throws Exception {
stack = Contentstack.stack(appContext, DEFAULT_API_KEY, DEFAULT_DELIVERY_TOKEN, DEFAULT_ENV, config);
}

@Test
public void test_I_fetch_asset_by_title() {
final AssetLibrary assetLibrary = stack.assetLibrary().where("title", "iot-icon.png");
assetLibrary.fetchAll(new FetchAssetsCallback() {
@Override
public void onCompletion(ResponseType responseType, List<Asset> assets, Error error) {
if (error == null) {
for (Asset asset : assets) {
Log.d("RESULT:", "resp" + asset.json);
}
}
}
});
}

@Test
public void test_J_fetch_asset_by_tags() {
final AssetLibrary assetLibrary = stack.assetLibrary().where("tags","tag1");
Expand Down Expand Up @@ -240,18 +186,6 @@ public void onCompletion(ResponseType responseType, List<Asset> assets, Error er
});
}

@Test
public void test_L_fetch_asset_invalid() {
final AssetLibrary assetLibrary = stack.assetLibrary().where("title",null);
assetLibrary.fetchAll(new FetchAssetsCallback() {
@Override
public void onCompletion(ResponseType responseType, List<Asset> assets, Error error) {
Log.e("RESULT:", "ERROR:"+ error.errorMessage);
}
});

}

@Test
public void test_M_fetch_asset_empty_title() {
final AssetLibrary assetLibrary = stack.assetLibrary().where("title","");
Expand Down
Loading

0 comments on commit 8b85986

Please sign in to comment.