Skip to content

Commit f10a29d

Browse files
committed
PR: feedback
1 parent 3785653 commit f10a29d

File tree

7 files changed

+34
-100
lines changed

7 files changed

+34
-100
lines changed
Lines changed: 29 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,36 @@
1-
import EventEmitter from "wolfy87-eventemitter";
2-
import OrganizationFullPage from "../src/OrganizationFullPage";
31
import { IOrgFullPageLocationInitData, LocationType } from "../src/types";
42
import { OrganizationDetails } from "../src/types/organization.types";
53

6-
describe("OrganizationFullPage", () => {
7-
const mockConnection = {
8-
sendToParent: jest.fn().mockReturnValue(Promise.resolve({})),
9-
};
10-
const mockEmitter: EventEmitter = new EventEmitter();
11-
const mockData: IOrgFullPageLocationInitData = {
12-
type: LocationType.ORGANIZATION_FULL_PAGE,
13-
app_id: "app_id",
14-
installation_uid: "installation_uid",
15-
extension_uid: "extension_uid",
16-
region: "NA",
17-
stack: {} as any,
18-
user: {} as any,
19-
currentBranch: "currentBranch",
20-
organization: {} as OrganizationDetails,
21-
};
22-
const organizationFullPage = new OrganizationFullPage(
23-
mockData,
24-
mockConnection as any,
25-
mockEmitter
26-
);
4+
const mockData: IOrgFullPageLocationInitData = {
5+
type: LocationType.ORGANIZATION_FULL_PAGE,
6+
app_id: "app_id",
7+
installation_uid: "installation_uid",
8+
extension_uid: "extension_uid",
9+
region: "NA",
10+
stack: {} as any,
11+
user: {} as any,
12+
currentBranch: "currentBranch",
13+
organization: {} as OrganizationDetails,
14+
};
15+
const organizationFullPage = {
16+
currentOrganization: mockData.organization,
17+
};
2718

28-
afterEach(() => {
29-
jest.clearAllMocks();
30-
});
19+
afterEach(() => {
20+
jest.clearAllMocks();
21+
});
3122

32-
it("should return organization details", () => {
33-
expect(organizationFullPage.currentOrganization).toBe(mockData.organization);
34-
});
23+
test("should return organization details", () => {
24+
expect(organizationFullPage.currentOrganization).toBe(mockData.organization);
25+
});
3526

36-
it("should handle missing organization details", () => {
37-
const invalidData: IOrgFullPageLocationInitData = {
38-
...mockData,
39-
organization: null as any, // check missing organization details
40-
};
41-
const invalidOrganizationFullPage = new OrganizationFullPage(
42-
invalidData,
43-
mockConnection as any,
44-
mockEmitter
45-
);
46-
expect(invalidOrganizationFullPage.currentOrganization).toBeNull();
47-
});
27+
test("should handle missing organization details", () => {
28+
const invalidData: IOrgFullPageLocationInitData = {
29+
...mockData,
30+
organization: null as any, // check missing organization details
31+
};
32+
const invalidOrganizationFullPage = {
33+
currentOrganization: invalidData.organization,
34+
};
35+
expect(invalidOrganizationFullPage.currentOrganization).toBeNull();
4836
});

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentstack/app-sdk",
3-
"version": "2.2.1",
3+
"version": "2.3.0",
44
"types": "dist/src/index.d.ts",
55
"description": "The Contentstack App SDK allows you to customize your Contentstack applications.",
66
"main": "dist/index.js",

src/OrganizationFullPage/index.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/types.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { Asset, ContentType, Schema, StackDetail } from "./types/stack.types";
99
import { OrganizationDetails } from "./types/organization.types";
1010
import { User } from "./types/user.types";
1111
import Window from "./window";
12-
import OrganizationFullPage from "./OrganizationFullPage";
1312

1413
export declare interface IDashboardWidget {
1514
frame: Window;
@@ -70,7 +69,7 @@ export declare interface IAppConfigWidget {
7069
}
7170

7271
export declare interface IOrgFullPageLocation {
73-
organization: OrganizationFullPage;
72+
currentOrganization: OrganizationDetails;
7473
}
7574

7675
export enum DashboardWidth {

src/types/organization.types.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,10 @@ import { GenericObjectType } from "./common.types";
33
export declare interface OrganizationDetails {
44
uid: string;
55
name: string;
6-
plan_id: string;
76
owner_uid: string;
8-
is_transfer_set: boolean;
97
expires_on: string;
108
enabled: boolean;
11-
is_over_usage_allowed: boolean;
129
created_at: string;
1310
updated_at: string;
14-
settings: GenericObjectType;
1511
tags: string[];
16-
plan?: {
17-
plan_id: string;
18-
name: string;
19-
message: string;
20-
price: string;
21-
features: {
22-
uid: string;
23-
name: string;
24-
enabled: boolean;
25-
limit: number;
26-
max_limit: number;
27-
is_required: boolean;
28-
depends_on: string[];
29-
}[];
30-
created_at: string;
31-
updated_at: string;
32-
blockedAssetTypes: any[];
33-
};
3412
}

src/uiLocation.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import EventEmitter from "wolfy87-eventemitter";
33

44
import AssetSidebarWidget from "./AssetSidebarWidget";
55
import ContentTypeSidebarWidget from "./ContentTypeSidebarWidget";
6-
import OrganizationFullPage from "./OrganizationFullPage";
76
import { IRTEPluginInitializer } from "./RTE/types";
87
import { AppConfig } from "./appConfig";
98
import Entry from "./entry";
@@ -268,11 +267,7 @@ class UiLocation {
268267

269268
case LocationType.ORGANIZATION_FULL_PAGE: {
270269
this.location.OrganizationFullPage = {
271-
organization: new OrganizationFullPage(
272-
initializationData,
273-
postRobot,
274-
emitter
275-
),
270+
currentOrganization: initializationData.organization,
276271
};
277272
break;
278273
}

0 commit comments

Comments
 (0)