From 786aca82f142b8ea564f48dca8de2d01e645af17 Mon Sep 17 00:00:00 2001 From: phntxx Date: Sun, 11 Jul 2021 15:58:42 +0200 Subject: [PATCH] Update tests, apply formatting --- src/components/greeter.tsx | 4 +--- src/components/icon.tsx | 4 +--- src/components/select.tsx | 17 ++++++++++++----- src/components/settings.tsx | 3 ++- src/lib/fetcher.tsx | 2 +- src/lib/theme.tsx | 5 ++++- src/lib/useMediaQuery.tsx | 2 +- src/test/app.spec.tsx | 11 ++++++++++- src/test/components/greeter.spec.tsx | 2 +- src/test/components/searchBar.spec.tsx | 2 ++ src/test/components/settings.spec.tsx | 22 +++++++++++++++++++--- src/test/lib/theme.spec.tsx | 20 ++++++++++++++++---- 12 files changed, 70 insertions(+), 24 deletions(-) diff --git a/src/components/greeter.tsx b/src/components/greeter.tsx index f5c1205..db30679 100644 --- a/src/components/greeter.tsx +++ b/src/components/greeter.tsx @@ -68,7 +68,7 @@ export const getGreeting = (greetings: Array): string => { * @returns {string} extension for that number */ export const getExtension = (day: number) => { - let extension = ""; + let extension = "th"; if (day % 10 === 1) { extension = "st"; @@ -76,8 +76,6 @@ export const getExtension = (day: number) => { extension = "nd"; } else if (day % 10 === 3) { extension = "rd"; - } else if (isBetween(day, 4, 20) || (day > 20 && day % 10 >= 4)) { - extension = "th"; } return extension; diff --git a/src/components/icon.tsx b/src/components/icon.tsx index ca1d5ab..ae9bb42 100644 --- a/src/components/icon.tsx +++ b/src/components/icon.tsx @@ -48,9 +48,7 @@ const IconContainer = styled.i` * @returns {React.ReactNode} the icon node */ export const Icon = ({ name, size }: IIconProps) => ( - - {name} - + {name} ); /** diff --git a/src/components/select.tsx b/src/components/select.tsx index 65d4229..e77a4b4 100644 --- a/src/components/select.tsx +++ b/src/components/select.tsx @@ -8,8 +8,9 @@ export interface IItemProps { export interface ISelectProps { items: Array; onChange: (item: any) => void; - current: string; + current?: string; className?: string; + testId?: string; } const update = ( @@ -20,18 +21,24 @@ const update = ( onChange(items.find((item) => item.value.toString() === e.target.value)); }; -const Select = ({ items, onChange, current, className }: ISelectProps) => ( +const Select = ({ + items, + onChange, + current, + className, + testId, +}: ISelectProps) => (