Skip to content

Commit

Permalink
Merge pull request #33 from contentstack/fix/DX-1009-livepreview-remo…
Browse files Browse the repository at this point in the history
…ve-hardcoded-endpoints

test: fix tests
  • Loading branch information
nadeem-cs authored Jul 29, 2024
2 parents c8bed98 + 0e63d0a commit dcb38eb
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test/unit/live-preview.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ describe('Live preview tests', () => {
environment: 'environment',
live_preview: {
enable: true,
management_token: 'management_token'
management_token: 'management_token',
host: 'api.contentstack.io'
}
})
const livePreviewObject = stack.config.live_preview
Expand All @@ -38,13 +39,14 @@ describe('Live preview tests', () => {
environment: 'environment',
live_preview: {
enable: false,
management_token: 'management_token'
management_token: 'management_token',
host: 'api.contentstack.io'
}
})
const livePreviewObject = stack.config.live_preview
expect(livePreviewObject).not.toBeUndefined();
expect(livePreviewObject).toHaveProperty('enable');
expect(livePreviewObject).not.toHaveProperty('host');
expect(livePreviewObject).toHaveProperty('host');
expect(livePreviewObject).not.toHaveProperty('preview');
expect(stack.config.host).toBe('cdn.contentstack.io');
});
Expand All @@ -56,14 +58,16 @@ describe('Live preview tests', () => {
environment: 'environment',
live_preview: {
enable: true,
preview_token: 'preview_token'
preview_token: 'preview_token',
host: 'rest-preview.contentstack.com'
}
})
const livePreviewObject = stack.config.live_preview
expect(livePreviewObject).not.toBeUndefined();
expect(livePreviewObject).toHaveProperty('enable');
expect(livePreviewObject).toHaveProperty('host');
expect(livePreviewObject).not.toHaveProperty('preview');
expect(livePreviewObject).toHaveProperty('preview_token');
expect(livePreviewObject).not.toHaveProperty('management_token');
expect(stack.config.host).toBe('rest-preview.contentstack.com');
});

Expand Down

0 comments on commit dcb38eb

Please sign in to comment.