Skip to content

Commit

Permalink
Moved test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
theankurkedia committed Feb 17, 2021
1 parent e22b149 commit 760614b
Show file tree
Hide file tree
Showing 17 changed files with 65 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ android/keystores/debug.keystore

# generated by bob
lib/
src/jest/mock.ts
6 changes: 2 additions & 4 deletions example/storybook/stories/hooks/useSafeArea/Usage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ function MyComponent() {
bg="teal.400"
height={200}
width={200}
position="absolute"
top={0}
right={0}
// safeAreaTop
// right={0}
safeAreaTop
// safeAreaLeft
// safeAreaX
// pt={6}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@react-native-community/eslint-config": "^2.0.0",
"@react-stately/radio": "^3.2.1",
"@release-it/conventional-changelog": "^1.1.4",
"@testing-library/react-hooks": "^4.0.0",
"@testing-library/react-hooks": "^5.0.3",
"@testing-library/react-native": "^7.1.0",
"@types/jest": "^26.0.0",
"@types/lodash": "^4.14.162",
Expand Down
4 changes: 2 additions & 2 deletions src/components/composites/Typeahead/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const Typeahead = (
onInputValueChange: ({ inputValue }) => {
onChangeText && onChangeText(inputValue);
setInputItems(
options.filter((item) =>
options.filter((item: any) =>
item.toLowerCase().includes(inputValue.toLowerCase())
)
);
Expand Down Expand Up @@ -103,7 +103,7 @@ const Typeahead = (
(numberOfItems && numberOfItems < inputItems.length
? inputItems.slice(0, numberOfItems)
: inputItems
).map((item, index) => (
).map((item: any, index: number) => (
<Link
isUnderlined={false}
key={`${item}${index}`}
Expand Down
4 changes: 2 additions & 2 deletions src/components/primitives/Box/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type {
customShadowProps,
customTransformProps,
customTypographyProps,
safeAreaProps,
SafeAreaProps,
} from '../../../utils/customProps';
import type { ITextProps } from './../Text/types';

Expand All @@ -41,7 +41,7 @@ export type IBoxProps = ViewProps &
customTransformProps &
customFlexboxProps &
BorderProps &
safeAreaProps & {
SafeAreaProps & {
style?: ViewStyle;
children?: JSX.Element | JSX.Element[] | string | any;
shadow?: number;
Expand Down
9 changes: 6 additions & 3 deletions src/components/primitives/Checkbox/CheckboxGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import Box from '../Box';

export let CheckboxGroupContext = createContext<ICheckboxContext | null>(null);

function CheckboxGroup({ size, colorScheme, ...props }: ICheckboxGroupProps) {
function CheckboxGroup(
{ size, colorScheme, ...props }: ICheckboxGroupProps,
ref?: any
) {
let { children } = props;
let state = useCheckboxGroupState(props);
let { groupProps } = useCheckboxGroup(props, state);
Expand All @@ -26,11 +29,11 @@ function CheckboxGroup({ size, colorScheme, ...props }: ICheckboxGroupProps) {
state,
}}
>
<Box alignItems="flex-start" {...groupProps} {...props}>
<Box alignItems="flex-start" {...groupProps} {...props} ref={ref}>
{children}
</Box>
</CheckboxGroupContext.Provider>
);
}

export default React.memo(CheckboxGroup);
export default React.memo(React.forwardRef(CheckboxGroup));
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { calculateProps } from './../../hooks/useThemeProps/utils';
import { calculateProps } from '../useThemeProps/utils';
import { theme } from 'native-base';
import { renderHook } from '@testing-library/react-hooks';
import { NativeBaseProvider } from 'native-base';
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/hooks/useSafeArea/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export function getSortedProps(props: any) {
let [
paddingProps,
sansPaddingProps,
] = themeTools.sortedExtractInObject(sansSafeAreaProps, [
] = themeTools.orderedExtractInObject(sansSafeAreaProps, [
'p',
'padding',
'pt',
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/theme/tools/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function getRandomString(length: number) {
}

// Inefficient way for pick, but retains order of props.
function myPick(obj: any, values: any) {
function orderedPick(obj: any, values: any) {
let ret: any = {};
Object.keys(obj).forEach((key: string) => {
if (values.includes(key)) {
Expand All @@ -30,9 +30,9 @@ function myPick(obj: any, values: any) {
return ret;
}

export function sortedExtractInObject(parent: any, values: Array<string>) {
export function orderedExtractInObject(parent: any, values: Array<string>) {
return [
omitUndefined(myPick(parent, values)),
omitUndefined(orderedPick(parent, values)),
omitUndefined(omit(parent, values)),
];
}
Expand Down
File renamed without changes.
55 changes: 46 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -997,13 +997,20 @@
pirates "^4.0.0"
source-map-support "^0.5.16"

"@babel/runtime@^7.0.0", "@babel/runtime@^7.12.5", "@babel/runtime@^7.6.2", "@babel/runtime@^7.8.4":
"@babel/runtime@^7.0.0", "@babel/runtime@^7.6.2", "@babel/runtime@^7.8.4":
version "7.12.5"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.5.tgz#410e7e487441e1b360c29be715d870d9b985882e"
integrity sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==
dependencies:
regenerator-runtime "^0.13.4"

"@babel/runtime@^7.12.5":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.13.tgz#0a21452352b02542db0ffb928ac2d3ca7cb6d66d"
integrity sha512-8+3UMPBrjFa/6TtKi/7sehPKqfAm4g6K+YQjyyFOLUTxzOngcRZTlAVY8sc2CORJYqdHQY8gRPHmn+qo15rCBw==
dependencies:
regenerator-runtime "^0.13.4"

"@babel/template@^7.0.0", "@babel/template@^7.10.4", "@babel/template@^7.12.7", "@babel/template@^7.3.3", "@babel/template@^7.8.6":
version "7.12.7"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.12.7.tgz#c817233696018e39fbb6c491d2fb684e05ed43bc"
Expand Down Expand Up @@ -2474,14 +2481,17 @@
dependencies:
defer-to-connect "^2.0.0"

"@testing-library/react-hooks@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@testing-library/react-hooks/-/react-hooks-4.0.0.tgz#5bb4caa5814690cfc3e385ffaaf2ca4d54a8d08e"
integrity sha512-AWIR4M1Fz4dYzuKytkWtabcrwpevq7zj9dImuBOcmrpl3VkjOBDa7Q/62fwK/M30ae5XI25mDSpQ29vzC7A5Lw==
"@testing-library/react-hooks@^5.0.3":
version "5.0.3"
resolved "https://registry.yarnpkg.com/@testing-library/react-hooks/-/react-hooks-5.0.3.tgz#dd0d2048817b013b266d35ca45e3ea48a19fd87e"
integrity sha512-UrnnRc5II7LMH14xsYNm/WRch/67cBafmrSQcyFh0v+UUmSf1uzfB7zn5jQXSettGwOSxJwdQUN7PgkT0w22Lg==
dependencies:
"@babel/runtime" "^7.12.5"
"@types/react" ">=16.9.0"
"@types/react-dom" ">=16.9.0"
"@types/react-test-renderer" ">=16.9.0"
filter-console "^0.1.1"
react-error-boundary "^3.1.0"

"@testing-library/react-native@^7.1.0":
version "7.1.0"
Expand Down Expand Up @@ -2665,6 +2675,13 @@
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.3.tgz#2ab0d5da2e5815f94b0b9d4b95d1e5f243ab2ca7"
integrity sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw==

"@types/react-dom@>=16.9.0":
version "17.0.1"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.1.tgz#d92d77d020bfb083e07cc8e0ac9f933599a4d56a"
integrity sha512-yIVyopxQb8IDZ7SOHeTovurFq+fXiPICa+GV3gp0Xedsl+MwQlMLKmvrnEjFbQxjliH5YVAEWFh975eVNmKj7Q==
dependencies:
"@types/react" "*"

"@types/react-native@*":
version "0.63.40"
resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.63.40.tgz#66b11824a6aadb0dde0db87bd8aff58165c7a8f8"
Expand All @@ -2680,20 +2697,28 @@
"@types/react" "*"

"@types/react-test-renderer@>=16.9.0":
version "17.0.0"
resolved "https://registry.yarnpkg.com/@types/react-test-renderer/-/react-test-renderer-17.0.0.tgz#9be47b375eeb906fced37049e67284a438d56620"
integrity sha512-nvw+F81OmyzpyIE1S0xWpLonLUZCMewslPuA8BtjSKc5XEbn8zEQBXS7KuOLHTNnSOEM2Pum50gHOoZ62tqTRg==
version "17.0.1"
resolved "https://registry.yarnpkg.com/@types/react-test-renderer/-/react-test-renderer-17.0.1.tgz#3120f7d1c157fba9df0118dae20cb0297ee0e06b"
integrity sha512-3Fi2O6Zzq/f3QR9dRnlnHso9bMl7weKCviFmfF6B4LS1Uat6Hkm15k0ZAQuDz+UBq6B3+g+NM6IT2nr5QgPzCw==
dependencies:
"@types/react" "*"

"@types/react@*", "@types/react@>=16.9.0":
"@types/react@*":
version "17.0.0"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.0.tgz#5af3eb7fad2807092f0046a1302b7823e27919b8"
integrity sha512-aj/L7RIMsRlWML3YB6KZiXB3fV2t41+5RBGYF8z+tAKU43Px8C3cYUZsDvf1/+Bm4FK21QWBrDutu8ZJ/70qOw==
dependencies:
"@types/prop-types" "*"
csstype "^3.0.2"

"@types/react@>=16.9.0":
version "17.0.2"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.2.tgz#3de24c4efef902dd9795a49c75f760cbe4f7a5a8"
integrity sha512-Xt40xQsrkdvjn1EyWe1Bc0dJLcil/9x2vAuW7ya+PuQip4UYUaXyhzWmAbwRsdMgwOFHpfp7/FFZebDU6Y8VHA==
dependencies:
"@types/prop-types" "*"
csstype "^3.0.2"

"@types/react@^16.9.19":
version "16.14.2"
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.14.2.tgz#85dcc0947d0645349923c04ccef6018a1ab7538c"
Expand Down Expand Up @@ -5574,6 +5599,11 @@ fill-range@^7.0.1:
dependencies:
to-regex-range "^5.0.1"

filter-console@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/filter-console/-/filter-console-0.1.1.tgz#6242be28982bba7415bcc6db74a79f4a294fa67c"
integrity sha512-zrXoV1Uaz52DqPs+qEwNJWJFAWZpYJ47UNmpN9q4j+/EYsz85uV0DC9k8tRND5kYmoVzL0W+Y75q4Rg8sRJCdg==

[email protected]:
version "1.1.2"
resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.2.tgz#b7e7d000ffd11938d0fdb053506f6ebabe9f587d"
Expand Down Expand Up @@ -9811,6 +9841,13 @@ react-devtools-core@^4.0.6:
shell-quote "^1.6.1"
ws "^7"

react-error-boundary@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/react-error-boundary/-/react-error-boundary-3.1.0.tgz#9487443df2f9ba1db90d8ab52351814907ea4af3"
integrity sha512-lmPrdi5SLRJR+AeJkqdkGlW/CRkAUvZnETahK58J4xb5wpbfDngasEGu+w0T1iXEhVrYBJZeW+c4V1hILCnMWQ==
dependencies:
"@babel/runtime" "^7.12.5"

react-is@^16.12.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
Expand Down

0 comments on commit 760614b

Please sign in to comment.