Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test/dx 1150 early access header testcases #66

Merged
merged 5 commits into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import android.content.Context;
import android.util.Log;
Expand Down Expand Up @@ -98,4 +99,30 @@ public void onCompletion(SyncStack syncStack, Error error) {
});
assertNotNull(stack.syncParams);
}

@Test
public void testEarlyAccess() throws Exception {
Context ctx = ApplicationProvider.getApplicationContext();
Config config = new Config();
String[] earlyAccess = {"Taxonomy"};
config.earlyAccess(earlyAccess);
stack = Contentstack.stack(ctx, apiKey, deliveryToken, environment, config);
assertEquals(earlyAccess[0], config.earlyAccess[0]);
assertNotNull(stack.localHeader.containsKey("x-header-ea"));
assertEquals("Taxonomy", stack.localHeader.get("x-header-ea"));
}

@Test
public void testConfigEarlyAccessMultipleFeature() throws Exception {
Context ctx = ApplicationProvider.getApplicationContext();
Config config = new Config();
String[] earlyAccess = {"Taxonomy", "Teams", "Terms", "LivePreview"};
config.earlyAccess(earlyAccess);
stack = Contentstack.stack(ctx, apiKey, deliveryToken, environment, config);
assertEquals(4, stack.localHeader.keySet().size());
assertEquals(earlyAccess[1], config.earlyAccess[1]);
assertTrue(stack.localHeader.containsKey("x-header-ea"));
assertEquals("Taxonomy,Teams,Terms,LivePreview", stack.localHeader.get("x-header-ea"));
}

}
Loading