Skip to content

Commit

Permalink
tests: additional unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dmijatovic committed Aug 21, 2023
1 parent a9dc400 commit d338619
Show file tree
Hide file tree
Showing 28 changed files with 55 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function useContributors({token, orderBy}:useContributorsProps) {
const {searchFor, page, rows, setCount} = usePaginationWithSearch('Find contributor')
const [contributors, setContributors] = useState<RsdContributor[]>([])
const [loading, setLoading] = useState(true)
const [columns, setColumns] = useState(createColumns(token))
const [columns] = useState(createColumns(token))

const loadContributors = useCallback(async () => {
let abort = false
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/cards/CardContentFrame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'

export default function CardContentFrame({children}:{children:React.JSX.Element[]}) {
export default function CardContentFrame({children}:{children:JSX.Element[]}) {
return (
<div className="h-[63%] flex flex-col p-4 relative">
{children}
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/cards/CardImageFrame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'

export default function CardImageFrame({children}:{children:React.JSX.Element}) {
export default function CardImageFrame({children}:{children:JSX.Element}) {
return (
<div className="h-[37%] flex overflow-hidden relative bg-base-100">
{children}
Expand Down
5 changes: 2 additions & 3 deletions frontend/components/form/ControlledTextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {useEffect, useRef} from 'react'
import {useEffect, useRef, JSX} from 'react'
import {Controller} from 'react-hook-form'
import TextField, {TextFieldProps} from '@mui/material/TextField'
import HelperTextWithCounter from './HelperTextWithCounter'
Expand All @@ -25,7 +24,7 @@ export type ControlledTextFieldOptions<T> = {
variant?: 'outlined'|'standard'
useNull?: boolean,
defaultValue?: string | number | null
helperTextMessage?: string | React.JSX.Element
helperTextMessage?: string | JSX.Element
helperTextCnt?: string
disabled?: boolean
muiProps?: TextFieldProps
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/form/HelperTextWithCounter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'

export default function HelperTextWithCounter({message,count}:{message:string|undefined|React.JSX.Element,count:string}) {
export default function HelperTextWithCounter({message,count}:{message:string|undefined|JSX.Element,count:string}) {
return (
<>
<span className="mr-2">{message}</span>
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/layout/ConfirmDeleteModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'
import Button from '@mui/material/Button'
import Dialog from '@mui/material/Dialog'
import DialogActions from '@mui/material/DialogActions'
Expand All @@ -19,7 +19,7 @@ import WarningIcon from '@mui/icons-material/Warning'
type ConfirmDeleteModalProps = {
open: boolean,
title: string,
body: React.JSX.Element,
body: JSX.Element,
onCancel: () => void,
onDelete: () => void
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/layout/ContentContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'

type ContentContainerProps = {
element?: 'section' | 'article' | 'main' | 'div'
className?: string
children: React.JSX.Element | React.JSX.Element[]
children: JSX.Element | JSX.Element[]
}

export default function ContentContainer(props: ContentContainerProps) {
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/layout/SortableList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'
import {
DndContext, DragEndEvent, useSensor,
useSensors, TouchSensor, MouseSensor
Expand All @@ -23,7 +23,7 @@ export type RequiredListProps = {
type SortableListProps<T extends RequiredListProps>={
items:T[],
onSorted: (items: T[]) => void
onRenderItem:(item:T,index:number) => React.JSX.Element
onRenderItem:(item:T,index:number) => JSX.Element
}

export default function SortableList<T extends RequiredListProps>({
Expand Down
5 changes: 2 additions & 3 deletions frontend/components/mention/editMentionContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {createContext} from 'react'
import {createContext,JSX} from 'react'
import {MentionItemProps} from '~/types/Mention'
import {EditMentionAction, EditMentionState} from './editMentionReducer'
import NoMentionItems from './NoMentionItems'

export type EditMentionSettings = {
editModalTitle: string,
confirmDeleteModalTitle: string,
noItemsComponent:()=>React.JSX.Element
noItemsComponent:()=>JSX.Element
}

export type EditModalProps = {
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/menu/IconBtnMenuOnAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//
// SPDX-License-Identifier: Apache-2.0

import {useState} from 'react'
import {useState, JSX} from 'react'
import IconButton from '@mui/material/IconButton'
import MoreVertIcon from '@mui/icons-material/MoreVert'
import Menu from '@mui/material/Menu'
Expand All @@ -16,7 +16,7 @@ export type IconBtnMenuOption<T> = {
type: 'divider' | 'action'
key: string,
label: string,
icon?: React.JSX.Element,
icon?: JSX.Element,
action: T
disabled?: boolean,
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/organisation/metadata/Links.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'
import Link from 'next/link'

export type LinksProps = {
title: string,
url: string
icon: React.JSX.Element,
icon: JSX.Element,
}

export default function Links({links=[]}:{links:LinksProps[]}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'
import InfoIcon from '@mui/icons-material/Info'
import PersonIcon from '@mui/icons-material/Person'
import SettingsIcon from '@mui/icons-material/Settings'
Expand All @@ -14,7 +14,7 @@ export type SettingsMenuProps = {
id: string,
status: string,
label: (props?:any)=>string,
icon: React.JSX.Element
icon: JSX.Element
}

export const settingsMenu: SettingsMenuProps[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'
import InfoIcon from '@mui/icons-material/Info'
import TerminalIcon from '@mui/icons-material/Terminal'
import AccountTreeIcon from '@mui/icons-material/AccountTree'
Expand All @@ -21,7 +21,7 @@ type IsVisibleProps = Partial<OrganisationForOverview> & {
export type OrganisationTabItemProps = {
id: string,
label: (props:any)=>string,
icon: React.JSX.Element,
icon: JSX.Element,
isVisible: (props: IsVisibleProps) => boolean
}

Expand Down
2 changes: 0 additions & 2 deletions frontend/components/organisation/units/ResearchUnitItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ type UnitListItemProps = {

export default function UnitItem({pos,slug,name,website,logo_id,isMaintainer,onEdit}: UnitListItemProps) {
const router = useRouter()
// remove query params from url (id)
const baseUrl = router.asPath.split('?')
const slugs = []
if (typeof router.query['slug'] === 'string') {
slugs.push(router.query['slug'])
Expand Down
6 changes: 3 additions & 3 deletions frontend/components/projects/edit/editProjectPages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'
import dynamic from 'next/dynamic'

import InfoIcon from '@mui/icons-material/Info'
Expand Down Expand Up @@ -53,8 +53,8 @@ export type EditProjectPageProps = {
id: string,
status: string,
label: string,
icon: React.JSX.Element,
render: () => React.JSX.Element
icon: JSX.Element,
render: () => JSX.Element
}

export const editProjectPage: EditProjectPageProps[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'

export default function ProjectOverviewGrid({children}: { children: React.JSX.Element | React.JSX.Element[] }) {
export default function ProjectOverviewGrid({children}: { children: JSX.Element | JSX.Element[] }) {
// console.log('ProjectOverviewGrid')
return (
<section
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'
import {getImageUrl} from '~/utils/editImage'
import useValidateImageSrc from '~/utils/useValidateImageSrc'
import ProjectMetrics from '../cards/ProjectMetrics'
Expand All @@ -16,7 +16,7 @@ type ProjectListItemProps = {
image_id: string | null
impact_cnt: number | null
output_cnt: number | null
statusBanner?: React.JSX.Element
statusBanner?: JSX.Element
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'

export default function ProjectOverviewList({children}: { children: React.JSX.Element | React.JSX.Element[]}) {
export default function ProjectOverviewList({children}: { children: JSX.Element | JSX.Element[]}) {
return (
<section
data-testid="project-overview-list"
Expand Down
6 changes: 3 additions & 3 deletions frontend/components/software/edit/editSoftwarePages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'
import dynamic from 'next/dynamic'

import InfoIcon from '@mui/icons-material/Info'
Expand Down Expand Up @@ -56,8 +56,8 @@ export type EditSoftwarePageProps = {
id: string
status: string,
label: string,
icon: React.JSX.Element,
render: () => React.JSX.Element
icon: JSX.Element,
render: () => JSX.Element
}

export const editSoftwarePage:EditSoftwarePageProps[] = [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'

export default function SoftwareOverviewGrid({children}: { children: React.JSX.Element | React.JSX.Element[] }) {
export default function SoftwareOverviewGrid({children}: { children: JSX.Element | JSX.Element[] }) {
return (
<section
data-testid="software-overview-grid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'

export default function SoftwareOverviewMasonry({children}: { children: React.JSX.Element | React.JSX.Element[] }) {
export default function SoftwareOverviewMasonry({children}: { children: JSX.Element | JSX.Element[] }) {
return (
<section
data-testid="software-overview-masonry"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'

type OverviewListItemProps = {
children: React.JSX.Element | React.JSX.Element[],
children: JSX.Element | JSX.Element[],
className?: string
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'
import {getImageUrl} from '~/utils/editImage'
import useValidateImageSrc from '~/utils/useValidateImageSrc'
import SoftwareMetrics from '../cards/SoftwareMetrics'
Expand All @@ -22,7 +22,7 @@ type SoftwareOverviewListItemProps = {
// prog_lang: string[],
// licenses: string,
downloads?: number
statusBanner?: React.JSX.Element
statusBanner?: JSX.Element
}

export default function SoftwareListItemContent(item:SoftwareOverviewListItemProps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'

export default function SoftwareOverviewList({children}: { children: React.JSX.Element | React.JSX.Element[] }) {
export default function SoftwareOverviewList({children}: { children: JSX.Element | JSX.Element[] }) {
return (
<section
data-testid="software-overview-list"
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/table/EditableTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'
import {SxProps, Theme} from '@mui/system'
import Table from '@mui/material/Table'
import TableBody from './TableBody'
Expand All @@ -29,7 +29,7 @@ export type Column<T,K extends keyof T> = {
sx?: SxProps<Theme>
order?: OrderProps
patchFn?: (props: UpdateProps) => Promise<{ status: number, message: string }>
renderFn?: (data:T) => React.JSX.Element
renderFn?: (data:T) => JSX.Element
}

export type OrderByProps<T,K extends keyof T> = {
Expand Down
6 changes: 3 additions & 3 deletions frontend/components/user/UserNavItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import {JSX} from 'react'
import dynamic from 'next/dynamic'

import TerminalIcon from '@mui/icons-material/Terminal'
Expand Down Expand Up @@ -44,8 +44,8 @@ export type UserMenuProps = {
id: string,
status: string,
label: (props:any)=>string,
icon: React.JSX.Element,
component: (props: any) => React.JSX.Element
icon: JSX.Element,
component: (props: any) => JSX.Element
showSearch: boolean
}

Expand Down
Loading

0 comments on commit d338619

Please sign in to comment.