Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove extra.app.settings key in item #623

Merged
merged 1 commit into from
Aug 21, 2024
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
1 change: 0 additions & 1 deletion src/item/appItem/appItem.factory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ describe('AppItemFactory', () => {
it('Create app item', () => {
const item = AppItemFactory();
expect(item.extra.app.url).toContain('http');
expect(item.extra.app.settings).toBeDefined();
expect(item.type).toEqual(ItemType.APP);
});
it('Create app item with args', () => {
Expand Down
1 change: 0 additions & 1 deletion src/item/appItem/appItem.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export const AppItemFactory = (
extra: item.extra ?? {
[ItemType.APP]: {
url: faker.internet.url(),
settings: {},
},
},
};
Expand Down
9 changes: 3 additions & 6 deletions src/item/appItem/appItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,19 @@ export type AppItemType<S = ItemSettings> = {
*/
export type AppItemExtraProperties = {
url: string;
// todo: there currently is nothing stored in the settings. this might change later
settings?: unknown;
};
export interface AppItemExtra {
export type AppItemExtra = {
[ItemType.APP]: AppItemExtraProperties;
}
};

export const getAppExtra = <U extends AppItemExtra>(
extra: U,
): U[typeof ItemType.APP] => extra[ItemType.APP];

export const buildAppExtra = ({
url,
settings = {},
}: AppItemExtraProperties): AppItemExtra => ({
[ItemType.APP]: { url, settings },
[ItemType.APP]: { url },
});

/**
Expand Down