Skip to content

Commit

Permalink
Azure na region added
Browse files Browse the repository at this point in the history
  • Loading branch information
uttamukkoji committed Apr 1, 2022
1 parent 48a072a commit 958358c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
3 changes: 2 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export class Utils {
//Enum for Contentstack Region
export enum Region {
US = "us",
EU = "eu"
EU = "eu",
AZURE_NA = "azure-na"
}

//Enum for Contentstack CachePolicy
Expand Down
3 changes: 2 additions & 1 deletion src/core/contentstackregion.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const ContentstackRegion = {
EU: "eu",
US: "us"
US: "us",
AZURE_NA: "azure-na"
};

export default ContentstackRegion;
Expand Down
35 changes: 35 additions & 0 deletions test/typescript/stack.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,41 @@ describe('Stack tests', () => {
done();
});

test('Stack initialization with Contentstack Config with fetchOptions, Azure-NA region test', done => {
const config : Contentstack.Config = {
api_key: 'api_key',
delivery_token: 'delivery_token',
environment: 'environment',
region: Contentstack.Region.AZURE_NA,
fetchOptions:{
timeout: 2000,
retryLimit: 4,
retryDelay: 40
}
};
const stack = Contentstack.Stack(config);

expect(stack.cachePolicy).toEqual(Contentstack.CachePolicy.IGNORE_CACHE);
expect(stack.environment).toEqual('environment');
expect(stack.config.host).toEqual('azure-na-cdn.contentstack.com');
expect(stack.config.port).toEqual(443);
expect(stack.config.version).toEqual("v3");
expect(stack.fetchOptions.timeout).toEqual(2000);
expect(stack.fetchOptions.retryLimit).toEqual(4);
expect(stack.fetchOptions.retryDelay).toEqual(40);
done();
});

test('Stack initialization with region EU test', done => {
const stack = Contentstack.Stack('api_key', 'delivery_token', 'environment', Contentstack.Region.AZURE_NA);
expect(stack.cachePolicy).toEqual(Contentstack.CachePolicy.IGNORE_CACHE);
expect(stack.environment).toEqual('environment');
expect(stack.config.host).toEqual('azure-na-cdn.contentstack.com');
expect(stack.config.port).toEqual(443);
expect(stack.config.version).toEqual("v3");
done();
});

test('Stack initialization with region EU and fetchOptions test', done => {
const stack = Contentstack.Stack('api_key', 'delivery_token', 'environment', Contentstack.Region.EU, {
timeout: 2000
Expand Down

0 comments on commit 958358c

Please sign in to comment.