Skip to content

Commit

Permalink
fix: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
robertu7 committed May 2, 2024
1 parent c9c4520 commit e45117a
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/components/ArticleDigest/Archived/Archived.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ describe('<ArticleDigest.Archived>', () => {
expect($title).toBeInTheDocument()

$title.click()
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.slug)
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.shortHash)
})
})
5 changes: 1 addition & 4 deletions src/components/ArticleDigest/Archived/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'

import { TEST_ID } from '~/common/enums'
import { UtmParams } from '~/common/utils'
import { DateTime } from '~/components'
import { ArticleDigestTitleArticleFragment } from '~/gql/graphql'

Expand All @@ -10,12 +9,10 @@ import styles from './styles.module.css'

export type ArticleDigestArchivedProps = {
article: ArticleDigestTitleArticleFragment & { createdAt: string }
} & UtmParams
}

export const ArticleDigestArchived = ({
article,
utm_source,
utm_medium,
}: ArticleDigestArchivedProps) => {
return (
<section
Expand Down
2 changes: 1 addition & 1 deletion src/components/ArticleDigest/Card/Card.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('<ArticleDigest.Card>', () => {
expect($author).toBeInTheDocument()

$digest.click()
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.slug)
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.shortHash)
expect(handleClickDigest).toHaveBeenCalled()

$author.click()
Expand Down
2 changes: 1 addition & 1 deletion src/components/ArticleDigest/Curated/Curated.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('<ArticleDigest.Curated>', () => {
expect($author).toBeInTheDocument()

$digest.click()
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.slug)
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.shortHash)
expect(handleClickDigest).toHaveBeenCalled()

$author.click()
Expand Down
4 changes: 2 additions & 2 deletions src/components/ArticleDigest/Dropdown/Dropdown.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('<ArticleDigest.Dropdown>', () => {
expect($author).toBeInTheDocument()

$digest.click()
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.slug)
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.shortHash)
expect(handleClickDigest).toHaveBeenCalled()
})

Expand All @@ -52,7 +52,7 @@ describe('<ArticleDigest.Dropdown>', () => {
expect($author).toBeInTheDocument()

$digest.click()
expect(mockRouter.asPath).not.toContain(MOCK_ARTILCE.slug)
expect(mockRouter.asPath).not.toContain(MOCK_ARTILCE.shortHash)
expect(handleClickDigest).not.toHaveBeenCalled()
})
})
4 changes: 2 additions & 2 deletions src/components/ArticleDigest/Feed/Feed.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('<ArticleDigest.Feed>', () => {
const $title = screen.getByRole('heading', { name: MOCK_ARTILCE.title })
expect($title).toBeInTheDocument()
$title.click()
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.slug)
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.shortHash)
expect(handleClickDigest).toBeCalledTimes(1)

mockRouter.back()
Expand All @@ -34,7 +34,7 @@ describe('<ArticleDigest.Feed>', () => {
const $summary = screen.getByText(MOCK_ARTILCE.summary)
expect($summary).toBeInTheDocument()
$summary.click()
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.slug)
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.shortHash)
expect(handleClickDigest).toBeCalledTimes(2)

mockRouter.back()
Expand Down
2 changes: 1 addition & 1 deletion src/components/ArticleDigest/List/List.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('<ArticleDigest.List>', () => {
expect($author).toBeInTheDocument()

$digest.click()
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.slug)
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.shortHash)
expect(handleClickDigest).toHaveBeenCalled()
})
})
2 changes: 1 addition & 1 deletion src/components/ArticleDigest/Notice/Notice.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ describe('<ArticleDigest.Notice>', () => {
expect($summary).toBeInTheDocument()

$digest.click()
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.slug)
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.shortHash)
})
})
2 changes: 1 addition & 1 deletion src/components/ArticleDigest/Published/Published.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('<ArticleDigest.Published>', () => {
const $title = screen.getByRole('heading', { name: MOCK_ARTILCE.title })
expect($title).toBeInTheDocument()
$title.click()
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.slug)
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.shortHash)

mockRouter.back()
})
Expand Down
2 changes: 1 addition & 1 deletion src/components/ArticleDigest/Sidebar/Sidebar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('<ArticleDigest.Sidebar>', () => {
expect($author).toBeInTheDocument()

$digest.click()
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.slug)
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.shortHash)
expect(handleClickDigest).toHaveBeenCalled()

$author.click()
Expand Down
4 changes: 2 additions & 2 deletions src/components/ArticleDigest/Title/Title.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('<ArticleDigest.Title>', () => {
expect($title).toBeInTheDocument()

$title.click()
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.slug)
expect(mockRouter.asPath).toContain(MOCK_ARTILCE.shortHash)
expect(handleClickDigest).toHaveBeenCalled()
})

Expand Down Expand Up @@ -56,7 +56,7 @@ describe('<ArticleDigest.Title>', () => {
})

$title.click()
expect(mockRouter.asPath).not.toContain(MOCK_ARTILCE.slug)
expect(mockRouter.asPath).not.toContain(MOCK_ARTILCE.shortHash)
expect(handleClickDigest).not.toHaveBeenCalled()
})

Expand Down
2 changes: 1 addition & 1 deletion src/components/Comment/CreatedAt/CreatedAt.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('<Comemnt/CreatedAt>', () => {
expect($time).toBeInTheDocument()

$time.click()
expect(mockRouter.asPath).toContain(MOCK_COMMENT.node.slug)
expect(mockRouter.asPath).toContain(MOCK_COMMENT.id)
})

it('should render a Comment/CreatedAt without link', () => {
Expand Down
1 change: 0 additions & 1 deletion src/components/Context/CommentDrafts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ export const CommentDraftsProvider = ({
}

const allEmptyDraft = checkAllDraftsEmpty()
console.log({ allEmptyDraft, drafts })
if (allEmptyDraft) {
navigateTo(url)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const USDTChoice: React.FC<FormProps> = ({
const curatorAddress = viewer.info.ethAddress
const creatorAddress = recipient.info.ethAddress

if (mediaHash === '') {
if (!mediaHash) {
return (
<section className={styles.item}>
<TextIcon
Expand Down
2 changes: 0 additions & 2 deletions src/components/TextIcon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ export const TextIcon: React.FC<React.PropsWithChildren<TextIconProps>> = ({
[styles.hasIcon]: !!icon,
})

console.log({ spacing, textIconClasses })

if (placement === 'left') {
return (
<span className={textIconClasses} {...restProps}>
Expand Down

0 comments on commit e45117a

Please sign in to comment.