Skip to content

Commit baadfeb

Browse files
fix: removed static url and updated the value of the url in test cases
1 parent 82a6acd commit baadfeb

File tree

8 files changed

+7
-32
lines changed

8 files changed

+7
-32
lines changed

src/config/index.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,6 @@ const config = {
55
manifestPath: resolve(__dirname, "manifest.json"),
66
boilerplateName: "marketplace-app-boilerplate-main",
77
developerHubBaseUrl: "",
8-
developerHubUrls: {
9-
// NOTE CDA url used as developer-hub url mapper to avoid conflict if user used any custom name
10-
"https://api.contentstack.io": "developerhub-api.contentstack.com",
11-
"https://eu-api.contentstack.com": "eu-developerhub-api.contentstack.com",
12-
"https://azure-na-api.contentstack.com":
13-
"azure-na-developerhub-api.contentstack.com",
14-
"https://azure-eu-api.contentstack.com":
15-
"azure-eu-developerhub-api.contentstack.com",
16-
"https://gcp-na-api.contentstack.com": "gcp-na-developerhub-api.contentstack.com",
17-
},
188
appBoilerplateGithubUrl:
199
"https://codeload.github.com/contentstack/marketplace-app-boilerplate/zip/refs/heads/main",
2010
defaultAppFileName: "manifest",

test/unit/commands/app/create.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ const { origin, pathname } = new URL(config.appBoilerplateGithubUrl);
1717
const zipPath = join(process.cwd(), "test", "unit", "mock", "boilerplate.zip");
1818
const region: { cma: string; name: string; cda: string } =
1919
configHandler.get("region");
20-
const developerHubBaseUrl = (config.developerHubUrls as Record<string, any>)[
21-
region.cma
22-
];
20+
const developerHubBaseUrl = configHandler.get("developerHubBaseUrl");
2321

2422
describe("app:create", () => {
2523
beforeEach(() => {

test/unit/commands/app/delete.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@ import { test, expect } from "@oclif/test";
22
import { cliux, configHandler, ux } from "@contentstack/cli-utilities";
33
import * as mock from "../../mock/common.mock.json"
44

5-
import config from "../../../../src/config";
65
import messages, {$t} from "../../../../src/messages";
76

87
const region: { cma: string; name: string; cda: string } =
98
configHandler.get("region");
10-
const developerHubBaseUrl = (config.developerHubUrls as Record<string, any>)[
11-
region.cma
12-
];
9+
const developerHubBaseUrl = configHandler.get("developerHubBaseUrl");
1310

1411
describe("app:delete", () => {
1512
describe("app:delete with --org and --app-uid flags", () => {

test/unit/commands/app/get.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ import * as commonUtils from "../../../../src/util/common-utils";
1212

1313
const region: { cma: string; name: string; cda: string } =
1414
configHandler.get("region");
15-
const developerHubBaseUrl = (config.developerHubUrls as Record<string, any>)[
16-
region.cma
17-
];
15+
const developerHubBaseUrl = configHandler.get("developerHubBaseUrl");
1816

1917
describe("app:get", () => {
2018
describe("Get app manifest", () => {

test/unit/commands/app/install.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ import {expect, test} from "@oclif/test";
33

44
import * as mock from "../../mock/common.mock.json"
55

6-
import config from "../../../../src/config";
76
import messages, { $t } from "../../../../src/messages";
87

98
const region: { cma: string, cda: string, name: string } = configHandler.get("region");
10-
const developerHubBaseUrl = (config.developerHubUrls as Record<string, any>)[region.cma];
9+
const developerHubBaseUrl = configHandler.get("developerHubBaseUrl");
1110

1211
describe("app:install", () => {
1312
describe("Install an app on organization", () => {

test/unit/commands/app/uninstall.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ import { expect, test } from "@oclif/test";
33

44
import * as mock from "../../mock/common.mock.json"
55

6-
import config from "../../../../src/config"
76
import messages, {$t} from "../../../../src/messages";
87

98
const region: { cma: string, cda: string, name: string } = configHandler.get("region");
10-
const developerHubBaseUrl = (config.developerHubUrls as Record<string, any>)[region.cma];
9+
const developerHubBaseUrl = configHandler.get("developerHubBaseUrl");
1110

1211
describe("app:uninstall", () => {
1312
describe("Uninstall an app from organization", () => {

test/unit/commands/app/update.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@ import { PassThrough } from "stream";
44
import { expect, test } from "@oclif/test";
55
import { cliux, ux, configHandler } from "@contentstack/cli-utilities";
66

7-
import config from "../../../../src/config";
87
import messages from "../../../../src/messages";
98
import * as mock from "../../mock/common.mock.json";
109
import manifestData from "../../config/manifest.json";
1110

1211
const region: { cma: string; name: string; cda: string } =
1312
configHandler.get("region");
14-
const developerHubBaseUrl = (config.developerHubUrls as Record<string, any>)[
15-
region.cma
16-
];
13+
const developerHubBaseUrl = configHandler.get("developerHubBaseUrl");
1714

1815
describe("app:update", () => {
1916
describe("Update app with `--app-manifest` flag", () => {

test/unit/util/common-utils.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@ import {
77
managementSDKClient,
88
} from "@contentstack/cli-utilities";
99

10-
import config from "../../../src/config";
1110
import { LogFn } from "../../../src/types";
1211
import * as mock from "../mock/common.mock.json";
1312
import { fetchApps, getOrganizations } from "../../../src/util/common-utils";
1413

1514
const region: { cma: string; name: string; cda: string } =
1615
configHandler.get("region");
17-
const developerHubBaseUrl = (config.developerHubUrls as Record<string, any>)[
18-
region.cma
19-
];
16+
const developerHubBaseUrl = configHandler.get("developerHubBaseUrl");
2017

2118
describe("common utils", () => {
2219
const log: LogFn = () => {};

0 commit comments

Comments
 (0)