Skip to content

Commit

Permalink
fix: remove extra.app.settings key in item (#623)
Browse files Browse the repository at this point in the history
  • Loading branch information
spaenleh authored Aug 21, 2024
1 parent 75024e0 commit b4de950
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
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

0 comments on commit b4de950

Please sign in to comment.