Skip to content

Commit 747dd34

Browse files
authored
Merge pull request #33 from contentstack/fix/DX-1009-livepreview-remove-hardcoded-endpoints
test: fix tests
2 parents 21f9a0d + ecdaede commit 747dd34

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

test/unit/live-preview.spec.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ describe('Live preview tests', () => {
2020
environment: 'environment',
2121
live_preview: {
2222
enable: true,
23-
management_token: 'management_token'
23+
management_token: 'management_token',
24+
host: 'api.contentstack.io'
2425
}
2526
})
2627
const livePreviewObject = stack.config.live_preview
@@ -38,13 +39,14 @@ describe('Live preview tests', () => {
3839
environment: 'environment',
3940
live_preview: {
4041
enable: false,
41-
management_token: 'management_token'
42+
management_token: 'management_token',
43+
host: 'api.contentstack.io'
4244
}
4345
})
4446
const livePreviewObject = stack.config.live_preview
4547
expect(livePreviewObject).not.toBeUndefined();
4648
expect(livePreviewObject).toHaveProperty('enable');
47-
expect(livePreviewObject).not.toHaveProperty('host');
49+
expect(livePreviewObject).toHaveProperty('host');
4850
expect(livePreviewObject).not.toHaveProperty('preview');
4951
expect(stack.config.host).toBe('cdn.contentstack.io');
5052
});
@@ -56,14 +58,16 @@ describe('Live preview tests', () => {
5658
environment: 'environment',
5759
live_preview: {
5860
enable: true,
59-
preview_token: 'preview_token'
61+
preview_token: 'preview_token',
62+
host: 'rest-preview.contentstack.com'
6063
}
6164
})
6265
const livePreviewObject = stack.config.live_preview
6366
expect(livePreviewObject).not.toBeUndefined();
6467
expect(livePreviewObject).toHaveProperty('enable');
6568
expect(livePreviewObject).toHaveProperty('host');
66-
expect(livePreviewObject).not.toHaveProperty('preview');
69+
expect(livePreviewObject).toHaveProperty('preview_token');
70+
expect(livePreviewObject).not.toHaveProperty('management_token');
6771
expect(stack.config.host).toBe('rest-preview.contentstack.com');
6872
});
6973

0 commit comments

Comments
 (0)