Skip to content

Commit 958358c

Browse files
committed
Azure na region added
1 parent 48a072a commit 958358c

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

index.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ export class Utils {
2121
//Enum for Contentstack Region
2222
export enum Region {
2323
US = "us",
24-
EU = "eu"
24+
EU = "eu",
25+
AZURE_NA = "azure-na"
2526
}
2627

2728
//Enum for Contentstack CachePolicy

src/core/contentstackregion.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const ContentstackRegion = {
22
EU: "eu",
3-
US: "us"
3+
US: "us",
4+
AZURE_NA: "azure-na"
45
};
56

67
export default ContentstackRegion;

test/typescript/stack.test.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,41 @@ describe('Stack tests', () => {
130130
done();
131131
});
132132

133+
test('Stack initialization with Contentstack Config with fetchOptions, Azure-NA region test', done => {
134+
const config : Contentstack.Config = {
135+
api_key: 'api_key',
136+
delivery_token: 'delivery_token',
137+
environment: 'environment',
138+
region: Contentstack.Region.AZURE_NA,
139+
fetchOptions:{
140+
timeout: 2000,
141+
retryLimit: 4,
142+
retryDelay: 40
143+
}
144+
};
145+
const stack = Contentstack.Stack(config);
146+
147+
expect(stack.cachePolicy).toEqual(Contentstack.CachePolicy.IGNORE_CACHE);
148+
expect(stack.environment).toEqual('environment');
149+
expect(stack.config.host).toEqual('azure-na-cdn.contentstack.com');
150+
expect(stack.config.port).toEqual(443);
151+
expect(stack.config.version).toEqual("v3");
152+
expect(stack.fetchOptions.timeout).toEqual(2000);
153+
expect(stack.fetchOptions.retryLimit).toEqual(4);
154+
expect(stack.fetchOptions.retryDelay).toEqual(40);
155+
done();
156+
});
157+
158+
test('Stack initialization with region EU test', done => {
159+
const stack = Contentstack.Stack('api_key', 'delivery_token', 'environment', Contentstack.Region.AZURE_NA);
160+
expect(stack.cachePolicy).toEqual(Contentstack.CachePolicy.IGNORE_CACHE);
161+
expect(stack.environment).toEqual('environment');
162+
expect(stack.config.host).toEqual('azure-na-cdn.contentstack.com');
163+
expect(stack.config.port).toEqual(443);
164+
expect(stack.config.version).toEqual("v3");
165+
done();
166+
});
167+
133168
test('Stack initialization with region EU and fetchOptions test', done => {
134169
const stack = Contentstack.Stack('api_key', 'delivery_token', 'environment', Contentstack.Region.EU, {
135170
timeout: 2000

0 commit comments

Comments
 (0)