-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcontentstack_spec.rb
More file actions
69 lines (55 loc) · 3 KB
/
contentstack_spec.rb
File metadata and controls
69 lines (55 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
require 'spec_helper'
require_relative '../lib/contentstack.rb'
describe Contentstack do
let(:client) { create_client }
let(:eu_client) { create_client('DELIVERY_TOKEN_TOKEN', 'API_KEY', 'STACK_ENV', {region: Contentstack::Region::EU}) }
let(:azure_na_client) { create_client('DELIVERY_TOKEN_TOKEN', 'API_KEY', 'STACK_ENV', {region: Contentstack::Region::AZURE_NA}) }
let(:azure_eu_client) { create_client('DELIVERY_TOKEN_TOKEN', 'API_KEY', 'STACK_ENV', {region: Contentstack::Region::AZURE_EU}) }
let(:custom_host_eu_client) { create_client('DELIVERY_TOKEN_TOKEN', 'API_KEY', 'STACK_ENV', {host: "contentstack.com", region: Contentstack::Region::EU}) }
let(:custom_host_azure_eu_client) { create_client('DELIVERY_TOKEN_TOKEN', 'API_KEY', 'STACK_ENV', {host: "contentstack.com", region: Contentstack::Region::AZURE_EU}) }
let(:custom_host_azure_na_client) { create_client('DELIVERY_TOKEN_TOKEN', 'API_KEY', 'STACK_ENV', {host: "contentstack.com", region: Contentstack::Region::AZURE_NA}) }
let(:custom_host_gcp_na_client) { create_client('DELIVERY_TOKEN_TOKEN', 'API_KEY', 'STACK_ENV', {host: "contentstack.com", region: Contentstack::Region::GCP_NA}) }
it "has a version number" do
expect(Contentstack::VERSION).not_to be nil
end
it "has region data" do
expect(Contentstack::Region::EU).not_to be 'eu'
expect(Contentstack::Region::US).not_to be 'us'
expect(Contentstack::Region::AZURE_NA).not_to be 'azure-na'
expect(Contentstack::Region::AZURE_EU).not_to be 'azure-eu'
end
it "has default host and region" do
expect(client.region).to eq Contentstack::Region::US
expect(client.host).to eq 'https://cdn.contentstack.io'
end
it "has custom region with region host" do
expect(eu_client.region).to eq Contentstack::Region::EU
expect(eu_client.host).to eq 'https://eu-cdn.contentstack.com'
end
it "has custom region with region host" do
expect(azure_na_client.region).to eq Contentstack::Region::AZURE_NA
expect(azure_na_client.host).to eq 'https://azure-na-cdn.contentstack.com'
end
it "has custom region with region host" do
expect(azure_eu_client.region).to eq Contentstack::Region::AZURE_EU
expect(azure_eu_client.host).to eq 'https://azure-eu-cdn.contentstack.com'
end
it "has custom host and eu region" do
expect(custom_host_eu_client.host).to eq 'https://eu-cdn.contentstack.com'
end
it "has custom host and azure-eu region" do
expect(custom_host_azure_eu_client.host).to eq 'https://azure-eu-cdn.contentstack.com'
end
it "has custom host and azure-na region" do
expect(custom_host_azure_na_client.host).to eq 'https://azure-na-cdn.contentstack.com'
end
it "has custom host and gcp-na region" do
expect(custom_host_gcp_na_client.host).to eq 'https://gcp-na-cdn.contentstack.com'
end
it "JSON to HTML" do
expect(Contentstack::json_to_html({}, ContentstackUtils::Model::Options.new())).to eq ''
end
it "JSON to HTML" do
expect(Contentstack::render_content('', ContentstackUtils::Model::Options.new())).to eq ''
end
end