Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mariojsnunes committed Jun 14, 2024
1 parent a6e149b commit bf8a6be
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
generateNewUserDetails,
} from '../../utils/TestUtils'

import { generateNewUserDetails } from '../../utils/TestUtils'

const researcherEmail = 'research_creator@test.com'
const researcherPassword = 'research_creator'
Expand Down Expand Up @@ -35,13 +32,8 @@ describe('[Research]', () => {

cy.step('Enter research article details')

cy.get('[data-cy=intro-title')
.clear()
.type(expected.title)
.blur()
cy.get('[data-cy=intro-description]')
.clear()
.type(expected.description)
cy.get('[data-cy=intro-title').clear().type(expected.title).blur()
cy.get('[data-cy=intro-description]').clear().type(expected.description)
cy.get('[data-cy=submit]').click()

cy.get('[data-cy=view-research]:enabled', { timeout: 20000 }).click()
Expand All @@ -56,20 +48,14 @@ describe('[Research]', () => {
cy.get('[data-cy=addResearchUpdateButton]').click()

cy.step('Enter update details')
cy.get('[data-cy=intro-title]')
.clear()
.type(updateTitle)
.blur()
cy.get('[data-cy=intro-title]').clear().type(updateTitle).blur()

cy.get('[data-cy=intro-description]')
.clear()
.type(updateDescription)
.blur()

cy.get('[data-cy=videoUrl]')
.clear()
.type(updateVideoUrl)
.blur()
cy.get('[data-cy=videoUrl]').clear().type(updateVideoUrl).blur()

cy.step('Save as Draft')
cy.get('[data-cy=draft]').click()
Expand Down
9 changes: 2 additions & 7 deletions packages/cypress/src/integration/research/write.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,8 @@ describe('[Research]', () => {

cy.step('Enter research article details')

cy.get('[data-cy=intro-title')
.clear()
.type(expected.title)
.blur()
cy.get('[data-cy=intro-description]')
.clear()
.type(expected.description)
cy.get('[data-cy=intro-title').clear().type(expected.title).blur()
cy.get('[data-cy=intro-description]').clear().type(expected.description)
cy.get('[data-cy=submit]').click()

cy.get('[data-cy=view-research]:enabled', { timeout: 20000 }).click()
Expand Down
10 changes: 8 additions & 2 deletions src/pages/Research/Content/ResearchArticle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ import { useCommonStores } from 'src/common/hooks/useCommonStores'
import { Breadcrumbs } from 'src/pages/common/Breadcrumbs/Breadcrumbs'
import { NotFoundPage } from 'src/pages/NotFound/NotFound'
import { useResearchStore } from 'src/stores/Research/research.store'
import { isAllowedToDeleteContent, isAllowedToEditContent } from 'src/utils/helpers'
import {
isAllowedToDeleteContent,
isAllowedToEditContent,
} from 'src/utils/helpers'
import { seoTagsUpdate } from 'src/utils/seo'
import { Box, Flex } from 'theme-ui'

import { getPublicUpdates, researchUpdateStatusFilter } from '../researchHelpers'
import {
getPublicUpdates,
researchUpdateStatusFilter,
} from '../researchHelpers'
import { researchCommentUrlPattern } from './helper'
import ResearchDescription from './ResearchDescription'
import ResearchUpdate from './ResearchUpdate'
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Research/researchHelpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describe('Research Helpers', () => {
it('should show when draft and current user is an Admin', async () => {
// prepare
const user = { _id: 'admin', userRoles: [UserRole.ADMIN] } as IUserPPDB
const item = { } as IResearch.Item
const item = {} as IResearch.Item
const update = { status: ResearchUpdateStatus.DRAFT } as IResearch.Update

// act
Expand Down
5 changes: 4 additions & 1 deletion src/pages/Research/researchHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export const researchUpdateStatusFilter = (
const isUpdateDraft = update.status === ResearchUpdateStatus.DRAFT
const isUpdateDeleted = update._deleted

return (isAdmin || isAuthor || isCollaborator || !isUpdateDraft) && !isUpdateDeleted
return (
(isAdmin || isAuthor || isCollaborator || !isUpdateDraft) &&
!isUpdateDeleted
)
}

export const getPublicUpdates = (
Expand Down
1 change: 0 additions & 1 deletion src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,3 @@ export const buildStatisticsLabel = ({

return `${typeof stat === 'number' ? stat : 0} ${statUnit}s`
}

0 comments on commit bf8a6be

Please sign in to comment.