Skip to content

Commit

Permalink
fix lint errors in stories
Browse files Browse the repository at this point in the history
  • Loading branch information
ekraffmiller committed Oct 29, 2024
1 parent 21acc36 commit d57826a
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 15 deletions.
8 changes: 7 additions & 1 deletion src/stories/account/Account.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { WithI18next } from '../WithI18next'
import { WithLayout } from '../WithLayout'
import { WithLoggedInUser } from '../WithLoggedInUser'
import { AccountHelper } from '../../sections/account/AccountHelper'
import { CollectionMockRepository } from '@/stories/collection/CollectionMockRepository'

const meta: Meta<typeof Account> = {
title: 'Pages/Account',
Expand All @@ -18,5 +19,10 @@ export default meta
type Story = StoryObj<typeof Account>

export const APITokenTab: Story = {
render: () => <Account defaultActiveTabKey={AccountHelper.ACCOUNT_PANEL_TABS_KEYS.apiToken} />
render: () => (
<Account
collectionRepository={new CollectionMockRepository()}
defaultActiveTabKey={AccountHelper.ACCOUNT_PANEL_TABS_KEYS.apiToken}
/>
)
}
12 changes: 6 additions & 6 deletions src/stories/collection/Collection.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const Default: Story = {
render: () => (
<Collection
collectionRepository={new CollectionMockRepository()}
collectionId="collection"
collectionIdFromParams="collection"
created={false}
published={false}
collectionQueryParams={{
Expand All @@ -39,8 +39,8 @@ export const Default: Story = {
export const Loading: Story = {
render: () => (
<Collection
collectionIdFromParams="collection"
collectionRepository={new CollectionLoadingMockRepository()}
collectionId="collection"
created={false}
published={false}
collectionQueryParams={{ pageQuery: 1, searchQuery: undefined, typesQuery: undefined }}
Expand All @@ -52,8 +52,8 @@ export const LoggedIn: Story = {
decorators: [WithLoggedInUser],
render: () => (
<Collection
collectionIdFromParams="collection"
collectionRepository={new CollectionMockRepository()}
collectionId="collection"
created={false}
published={false}
collectionQueryParams={{ pageQuery: 1, searchQuery: undefined, typesQuery: undefined }}
Expand All @@ -64,8 +64,8 @@ export const Unpublished: Story = {
decorators: [WithLoggedInUser],
render: () => (
<Collection
collectionIdFromParams="collection"
collectionRepository={new UnpublishedCollectionMockRepository()}
collectionId="collection"
created={false}
published={false}
collectionQueryParams={{ pageQuery: 1, searchQuery: undefined, typesQuery: undefined }}
Expand All @@ -78,7 +78,7 @@ export const Created: Story = {
render: () => (
<Collection
collectionRepository={new CollectionMockRepository()}
collectionId="collection"
collectionIdFromParams="collection"
created={true}
published={false}
collectionQueryParams={{ pageQuery: 1, searchQuery: undefined, typesQuery: undefined }}
Expand All @@ -90,7 +90,7 @@ export const Published: Story = {
render: () => (
<Collection
collectionRepository={new CollectionMockRepository()}
collectionId="collection"
collectionIdFromParams="collection"
created={false}
published={true}
collectionQueryParams={{ pageQuery: 1, searchQuery: undefined, typesQuery: undefined }}
Expand Down
2 changes: 1 addition & 1 deletion src/stories/collection/CollectionLoadingMockRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { CollectionItemSubset } from '@/collection/domain/models/CollectionItemS
import { CollectionSearchCriteria } from '@/collection/domain/models/CollectionSearchCriteria'

export class CollectionLoadingMockRepository extends CollectionMockRepository {
getById(_id: string): Promise<Collection> {
getById(_id?: string): Promise<Collection> {
return new Promise(() => {})
}
create(_collection: CollectionDTO, _hostCollection?: string): Promise<number> {
Expand Down
2 changes: 1 addition & 1 deletion src/stories/collection/CollectionMockRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { CollectionItemsMother } from '../../../tests/component/collection/domai
import { CollectionItemType } from '@/collection/domain/models/CollectionItemType'

export class CollectionMockRepository implements CollectionRepository {
getById(_id: string): Promise<Collection> {
getById(_id?: string): Promise<Collection> {
return new Promise((resolve) => {
setTimeout(() => {
resolve(CollectionMother.createRealistic())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FakerHelper } from '../../../tests/component/shared/FakerHelper'
import { CollectionMockRepository } from '@/stories/collection/CollectionMockRepository'

export class UnpublishedCollectionMockRepository extends CollectionMockRepository {
getById(_id: string): Promise<Collection> {
getById(_id?: string): Promise<Collection> {
return new Promise((resolve) => {
setTimeout(() => {
resolve(CollectionMother.createUnpublished())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ type Story = StoryObj<typeof CollectionCard>

export const Default: Story = {
render: () => (
<CollectionCard collectionPreview={CollectionItemTypePreviewMother.createRealistic()} />
<CollectionCard
parentCollectionAlias="parentAlias"
collectionPreview={CollectionItemTypePreviewMother.createRealistic()}
/>
)
}

Expand All @@ -24,19 +27,26 @@ export const WithLongDescription: Story = {
const collectionPreview = CollectionItemTypePreviewMother.create({
description: FakerHelper.paragraph(20)
})

return <CollectionCard collectionPreview={collectionPreview} />
return (
<CollectionCard parentCollectionAlias="parentAlias" collectionPreview={collectionPreview} />
)
}
}

export const Unpublished: Story = {
render: () => (
<CollectionCard collectionPreview={CollectionItemTypePreviewMother.createUnpublished()} />
<CollectionCard
parentCollectionAlias="parentAlias"
collectionPreview={CollectionItemTypePreviewMother.createUnpublished()}
/>
)
}

export const WithThumbnail: Story = {
render: () => (
<CollectionCard collectionPreview={CollectionItemTypePreviewMother.createWithThumbnail()} />
<CollectionCard
parentCollectionAlias="parentAlias"
collectionPreview={CollectionItemTypePreviewMother.createWithThumbnail()}
/>
)
}

0 comments on commit d57826a

Please sign in to comment.