Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/configManager/__test__/handleUserConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe("handleInitData()", () => {
const initData: Partial<IInitData> = {
enable: true,
stackDetails: {
apiKey: "bltanything",
apiKey: "YOUR_API_KEY",
environment: "",
},
};
Expand All @@ -64,7 +64,7 @@ describe("handleInitData()", () => {
enable: true,
cleanCslpOnProduction: true,
stackDetails: {
apiKey: "bltanything",
apiKey: "YOUR_API_KEY",
environment: "",
contentTypeUid: "",
entryUid: "",
Expand All @@ -90,7 +90,7 @@ describe("handleInitData()", () => {
const initData: Partial<IInitData> = {
enable: true,
stackDetails: {
apiKey: "bltanything",
apiKey: "YOUR_API_KEY",
environment: "",
},
};
Expand All @@ -103,15 +103,15 @@ describe("handleInitData()", () => {
const initData: Partial<IInitData> = {
enable: true,
stackDetails: {
apiKey: "bltanything",
apiKey: "YOUR_API_KEY",
environment: "",
},
stackSdk: {
live_preview: {
enable: true,
},
headers: {
api_key: "bltanything",
api_key: "YOUR_API_KEY",
},
environment: "",
cachePolicy: 1,
Expand All @@ -138,7 +138,7 @@ describe("handleInitData()", () => {
mode: "builder",
stackDetails: {
environment: "main",
apiKey: "bltanything",
apiKey: "YOUR_API_KEY",
},
};

Expand Down Expand Up @@ -176,23 +176,23 @@ describe("handleInitData()", () => {
const initData: Partial<IInitData> = {
enable: true,
stackDetails: {
apiKey: "bltuserapikey",
apiKey: "YOUR_API_KEY",
},
};

handleInitData(initData);
expect(config.stackDetails.apiKey).toBe("bltuserapikey");
expect(config.stackDetails.apiKey).toBe("YOUR_API_KEY");

initData.stackSdk = {
live_preview: {},
headers: {
api_key: "bltheaderapikey",
api_key: "YOUR_HEADER_API_KEY",
},
environment: "dev",
};

handleInitData(initData);
expect(config.stackDetails.apiKey).toBe("bltuserapikey");
expect(config.stackDetails.apiKey).toBe("YOUR_API_KEY");
});

test("should reset api key if it is not passed", () => {
Expand Down Expand Up @@ -270,7 +270,7 @@ describe("handleInitData()", () => {
const initData: Partial<IInitData> = {
enable: true,
stackDetails: {
apiKey: "bltapikey",
apiKey: "YOUR_API_KEY",
},
mode: "builder",
};
Expand All @@ -294,7 +294,7 @@ describe("handleInitData()", () => {
initData.stackSdk = {
live_preview: {},
headers: {
api_key: "bltapikey",
api_key: "YOUR_API_KEY",
branch: "sdkbranch",
},
environment: "dev",
Expand All @@ -311,7 +311,7 @@ describe("handleInitData()", () => {
stackSdk: {
live_preview: {},
headers: {
api_key: "sdkbranch",
api_key: "YOUR_API_KEY",
branch: "sdkbranch",
},
environment: "dev",
Expand Down
6 changes: 3 additions & 3 deletions src/livePreview/__test__/live-preview.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ describe("enable=false early return", () => {
Config.replace({
enable: false,
mode: "builder",
stackDetails: { environment: "preview", apiKey: "test-key" },
stackDetails: { environment: "preview", apiKey: "YOUR_API_KEY" },
});

new LivePreview();
Expand Down Expand Up @@ -656,7 +656,7 @@ describe("LivePreview edit button condition", () => {
enable: true,
editButton: { enable: false },
mode: "builder",
stackDetails: { environment: "preview", apiKey: "test-key" },
stackDetails: { environment: "preview", apiKey: "YOUR_API_KEY" },
});

new LivePreview();
Expand Down Expand Up @@ -745,7 +745,7 @@ describe("LivePreview init with partial stackDetails", () => {
Config.replace({
enable: true,
stackDetails: {
apiKey: "partial-key",
apiKey: "YOUR_API_KEY",
} as any,
});

Expand Down
8 changes: 4 additions & 4 deletions src/preview/__test__/contentstack-live-preview-HOC.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe("Live Preview HOC init", () => {
mode: "builder",
stackDetails: {
environment: "development",
apiKey: "livePreviewApiKey123",
apiKey: "YOUR_API_KEY",
},
});

Expand Down Expand Up @@ -171,13 +171,13 @@ describe("Live Preview HOC config", () => {
const userConfig: Partial<IInitData> = {
enable: true,
stackDetails: {
apiKey: "livePreviewApiKey123",
apiKey: "YOUR_API_KEY",
},
};

ContentstackLivePreview.init(userConfig);

expect(Config.get().stackDetails.apiKey).toBe("livePreviewApiKey123");
expect(Config.get().stackDetails.apiKey).toBe("YOUR_API_KEY");
});

test("should set the hash from the URL", async () => {
Expand Down Expand Up @@ -225,7 +225,7 @@ describe("Live Preview HOC config", () => {
const userConfig: Partial<IInitData> = {
enable: true,
stackDetails: {
apiKey: "livePreviewApiKey123",
apiKey: "YOUR_API_KEY",
},
};

Expand Down
Loading