Skip to content

Commit

Permalink
Merge pull request #66 from contentstack/test/DX-1150-Early-access-he…
Browse files Browse the repository at this point in the history
…ader-testcases

Test/dx 1150 early access header testcases
  • Loading branch information
cs-raj authored Sep 2, 2024
2 parents 6ade877 + 62ad245 commit 6faaa3f
Showing 1 changed file with 27 additions and 0 deletions.
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"));
}

}

0 comments on commit 6faaa3f

Please sign in to comment.