Skip to content

Commit f19a5f8

Browse files
committed
Loghandler test added
1 parent 6b97135 commit f19a5f8

File tree

6 files changed

+46
-10
lines changed

6 files changed

+46
-10
lines changed

test/typescript/asset-query.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import * as Contentstack from '../..';
22

3-
const stack = Contentstack.Stack({ api_key: 'api_key', delivery_token: 'delivery_token', environment: 'environment'});
3+
const stack = Contentstack.Stack({ api_key: 'api_key', delivery_token: 'delivery_token', environment: 'environment', fetchOptions: {
4+
logHandler: () => {
5+
6+
}
7+
}});
48

59
describe('Asset Query Test', () => {
610
test('Asset Query with UID', done => {

test/typescript/asset.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import * as Contentstack from '../..';
22

3-
const stack = Contentstack.Stack({ api_key: 'api_key', delivery_token: 'delivery_token', environment: 'environment'});
3+
const stack = Contentstack.Stack({ api_key: 'api_key', delivery_token: 'delivery_token', environment: 'environment',fetchOptions: {
4+
logHandler: () => {
5+
6+
}
7+
}
8+
});
49

510
describe('Asset Test', () => {
611
test('Asset with UID', done => {

test/typescript/contentType.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import * as Contentstack from '../..';
22

3-
const stack = Contentstack.Stack({ api_key: 'api_key', delivery_token: 'delivery_token', environment: 'environment'});
3+
const stack = Contentstack.Stack({ api_key: 'api_key', delivery_token: 'delivery_token', environment: 'environment', fetchOptions: {
4+
logHandler: () => {
5+
6+
}
7+
}});
48
describe('ContentType Test', () => {
59
test('ContentType UID', done => {
610
const contentType = stack.ContentType('uid');

test/typescript/entry-query.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import * as Contentstack from '../..';
22

3-
const stack = Contentstack.Stack({ api_key: 'api_key', delivery_token: 'delivery_token', environment: 'environment'});
3+
const stack = Contentstack.Stack({ api_key: 'api_key', delivery_token: 'delivery_token', environment: 'environment', fetchOptions: {
4+
logHandler: () => {
5+
6+
}
7+
}});
48

59
describe('Entry Query Test', () => {
610
test('Entry Query with UID', done => {

test/typescript/entry.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import * as Contentstack from '../..';
22

3-
const stack = Contentstack.Stack({ api_key: 'api_key', delivery_token: 'delivery_token', environment: 'environment'});
3+
const stack = Contentstack.Stack({ api_key: 'api_key', delivery_token: 'delivery_token', environment: 'environment', fetchOptions: {
4+
logHandler: () => {
5+
6+
}
7+
}});
48

59
describe('Entry Test', () => {
610
test('Entry with UID', done => {

test/typescript/stack.test.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ describe('Stack tests', () => {
4141

4242
test('Stack initialization with fetchOptions test', done => {
4343
const stack = Contentstack.Stack({ api_key: 'api_key', delivery_token: 'delivery_token', environment: 'environment', fetchOptions:{
44-
timeout: 2000
44+
timeout: 2000,
45+
logHandler: () => {
46+
47+
}
4548
}});
4649
expect(stack.cachePolicy).toEqual(Contentstack.CachePolicy.IGNORE_CACHE);
4750
expect(stack.environment).toEqual('environment');
@@ -79,7 +82,10 @@ describe('Stack tests', () => {
7982
fetchOptions:{
8083
timeout: 2000,
8184
retryLimit: 4,
82-
retryDelay: 40
85+
retryDelay: 40,
86+
logHandler: () => {
87+
88+
}
8389
}
8490
};
8591
const stack = Contentstack.Stack(config);
@@ -104,7 +110,10 @@ describe('Stack tests', () => {
104110
fetchOptions:{
105111
timeout: 2000,
106112
retryLimit: 4,
107-
retryDelay: 40
113+
retryDelay: 40,
114+
logHandler: () => {
115+
116+
}
108117
}
109118
};
110119
const stack = Contentstack.Stack(config);
@@ -139,7 +148,10 @@ describe('Stack tests', () => {
139148
fetchOptions:{
140149
timeout: 2000,
141150
retryLimit: 4,
142-
retryDelay: 40
151+
retryDelay: 40,
152+
logHandler: () => {
153+
154+
}
143155
}
144156
};
145157
const stack = Contentstack.Stack(config);
@@ -167,7 +179,10 @@ describe('Stack tests', () => {
167179

168180
test('Stack initialization with region EU and fetchOptions test', done => {
169181
const stack = Contentstack.Stack('api_key', 'delivery_token', 'environment', Contentstack.Region.EU, {
170-
timeout: 2000
182+
timeout: 2000,
183+
logHandler: () => {
184+
185+
}
171186
});
172187
expect(stack.cachePolicy).toEqual(Contentstack.CachePolicy.IGNORE_CACHE);
173188
expect(stack.environment).toEqual('environment');

0 commit comments

Comments
 (0)