Skip to content

Commit

Permalink
Merge branch 'master' into feat/DX-746-Variants-implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
sunil-lakshman committed Sep 3, 2024
2 parents 255f0e4 + 6faaa3f commit 01853f1
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 01853f1

Please sign in to comment.