Skip to content

Commit 2524fd6

Browse files
authored
Merge pull request #4989 from GeekyAnts/revert-4976-feat/unit-testing-jest
Revert "Feat/unit testing jest"
2 parents e2a21b9 + eab3af8 commit 2524fd6

File tree

30 files changed

+167042
-179405
lines changed

30 files changed

+167042
-179405
lines changed

example/.nvmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

example/__mocks__/@react-native-async-storage/async-storage.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

example/__mocks__/globalMock.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,3 @@ jest.mock('react-native-keyboard-aware-scroll-view', () => {
77
const KeyboardAwareScrollView = ({ children }) => children;
88
return { KeyboardAwareScrollView };
99
});
10-
11-
import mockAsyncStorage from '@react-native-async-storage/async-storage/jest/async-storage-mock';
12-
jest.mock('@react-native-async-storage/async-storage', () => mockAsyncStorage);

example/babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const pak = require('../package.json');
44
module.exports = function (api) {
55
api.cache(true);
66
return {
7-
presets: [['babel-preset-expo', { jsxRuntime: 'classic' }]],
7+
presets: ['babel-preset-expo'],
88
plugins: [
99
[
1010
'module-resolver',

example/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"dependencies": {
1919
"@expo/vector-icons": "^12.0.0",
2020
"@react-native-aria/overlays": "^0.2.9",
21-
"@react-native-async-storage/async-storage": "^1.17.3",
21+
"@react-native-async-storage/async-storage": "~1.15.0",
2222
"expo": "^44.0.0",
2323
"expo-font": "~10.0.4",
2424
"expo-linear-gradient": "~11.0.3",
@@ -42,7 +42,7 @@
4242
"@storybook/addon-links": "^5.3",
4343
"@storybook/addon-ondevice-actions": "^5.3.23",
4444
"@storybook/addon-ondevice-knobs": "^5.3.23",
45-
"@storybook/addon-storyshots": "6.3",
45+
"@storybook/addon-storyshots": "^6.3.4",
4646
"@storybook/react-native": "^5.3.23",
4747
"@storybook/react-native-server": "^5.3.23",
4848
"@types/react": "~17.0.21",
@@ -57,7 +57,7 @@
5757
"patch-package": "^6.2.2",
5858
"postinstall-postinstall": "^2.1.0",
5959
"react-dom": "17.0.1",
60-
"react-test-renderer": "17.0.1",
60+
"react-test-renderer": "^17.0.2",
6161
"typescript": "~4.3.5"
6262
},
6363
"private": false

example/scripts/test.sh

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,48 +12,16 @@ case "$OS" in
1212
*) rm -fR node_modules/react node_modules/react-native ;;
1313
esac
1414

15-
red=`tput setaf 1`
16-
green=`tput setaf 2`
17-
reset=`tput sgr0`
18-
19-
#TODO:- run script with nvm use/ facing issues with yarn test working with npm run test
20-
# script to be added
21-
#unset PREFIX
22-
# . ~/.nvm/nvm.sh
23-
# nvm install v14.19.0
24-
# nvm use
25-
2615
if [ $# -eq 0 ]
2716
then
2817
jest --config jest-ios.config.js --silent
2918
jest --config jest-android.config.js --silent
30-
NODEVERSION=$(node -v)
31-
echo "you are using node version $NODEVERSION"
32-
if [ $NODEVERSION != "v14.19.0" ]
33-
then
34-
echo "${red}Error! Node module v14.19.0 is not present or nvm is not installed
35-
${green}If you have node v14.19.0 run 'nvm use'
36-
Else run 'nvm install v14.19.0'${reset} "
37-
else
38-
jest --silent
39-
fi
40-
19+
jest --silent
4120
else
4221
echo "Tests will be updated!"
4322
jest --config jest-ios.config.js -u --silent
4423
jest --config jest-android.config.js -u --silent
45-
NODEVERSION=$(node -v)
46-
echo "you are using node version $NODEVERSION"
47-
if [ $NODEVERSION != "v14.19.0" ]
48-
then
49-
jest -u --silent
50-
echo "${red}Error! Node module v14.19.0 is not present or nvm is not installed
51-
${green}If you have node v14.19.0 run 'nvm use'
52-
Else run 'nvm install v14.19.0'${reset} "
53-
else
54-
jest -u --silent
55-
fi
56-
24+
jest -u --silent
5725
fi
5826

5927
yarn install --check-files
Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,5 @@
1-
import React, { useState } from 'react';
2-
import { StatusBar, Box, Text, Button } from 'native-base';
3-
1+
import React from 'react';
2+
import { StatusBar } from 'native-base';
43
export const Example = () => {
5-
const [hidden, setHidden] = useState(false);
6-
const changeStatusBarVisibility = () => setHidden(!hidden);
7-
return (
8-
<Box flex={1} justifyContent="center" safeArea>
9-
<StatusBar
10-
animated={true}
11-
backgroundColor="#61dafb"
12-
barStyle="default"
13-
showHideTransition="fade"
14-
hidden={hidden}
15-
/>
16-
<Text textAlign="center" mb={3}>
17-
StatusBar Visibility:{'\n'}
18-
{hidden ? 'Hidden' : 'Visible'}
19-
</Text>
20-
<Box p={10}>
21-
<Button onPress={changeStatusBarVisibility}>Toggle StatusBar</Button>
22-
</Box>
23-
</Box>
24-
);
4+
return <StatusBar />;
255
};

example/storybook/stories/components/composites/Alert/variant.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
VStack,
77
Text,
88
Divider,
9-
ScrollView,
9+
Center,
1010
} from 'native-base';
1111

1212
export function Example() {
@@ -30,16 +30,8 @@ export function Example() {
3030
};
3131

3232
return (
33-
<ScrollView mt={5}>
34-
<Stack
35-
space={3}
36-
w="90%"
37-
maxW="400"
38-
mr={5}
39-
flexDirection="column"
40-
justifyContent="center"
41-
alignItems="center"
42-
>
33+
<Center>
34+
<Stack space={3} w="90%" maxW="400">
4335
{[
4436
'solid',
4537
'left-accent',
@@ -80,6 +72,6 @@ export function Example() {
8072
);
8173
})}
8274
</Stack>
83-
</ScrollView>
75+
</Center>
8476
);
8577
}

example/storybook/stories/components/composites/Breadcrumb/Composition.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const Example = () => {
1313
<Breadcrumb spacing={2} _button={{ bg: 'transparent' }}>
1414
<Breadcrumb.Item>
1515
<Breadcrumb.Link>
16-
<HStack justifyContent="center" alignItems="center">
16+
<HStack>
1717
<Breadcrumb.Icon
1818
as={<MaterialIcons name="home" />}
1919
mr={1}
@@ -27,24 +27,22 @@ export const Example = () => {
2727
</Breadcrumb.Item>
2828
<Breadcrumb.Item>
2929
<Breadcrumb.Link href="https://alpha.nativebase.io/" isExternal>
30-
<HStack justifyContent="center" alignItems="center">
31-
<Breadcrumb.Icon
32-
fontWeight={'bold'}
33-
as={MaterialCommunityIcons}
34-
name="file-document"
35-
mr={1}
36-
size="xs"
37-
/>
38-
<Breadcrumb.Text>Docs</Breadcrumb.Text>
39-
</HStack>
30+
<Breadcrumb.Icon
31+
fontWeight={'bold'}
32+
as={MaterialCommunityIcons}
33+
name="file-document"
34+
mr={1}
35+
size="xs"
36+
/>
37+
<Breadcrumb.Text>Docs</Breadcrumb.Text>
4038
</Breadcrumb.Link>
4139
</Breadcrumb.Item>
4240
<Breadcrumb.Item isCurrent>
4341
<Breadcrumb.Link
4442
href="https://github.com/GeekyAnts/nativebase"
4543
isExternal
4644
>
47-
<HStack justifyContent="center" alignItems="center">
45+
<HStack>
4846
<Breadcrumb.Icon
4947
as={<AntDesign name="github" />}
5048
mr={1}

example/storybook/stories/components/composites/Breadcrumb/Separators.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ export const Example = () => {
66
<Heading mb={4}>Breadcrumb with String Separator</Heading>
77
<Breadcrumb separator={'-'}>
88
<Breadcrumb.Item isCurrent>
9-
<Breadcrumb.Link>
10-
<Breadcrumb.Text _current={{ color: 'red.500' }}>
11-
Home (This is currently active)
12-
</Breadcrumb.Text>
13-
</Breadcrumb.Link>
9+
<Breadcrumb.Link>Home (This is currently active)</Breadcrumb.Link>
1410
</Breadcrumb.Item>
1511
<Breadcrumb.Item>
1612
<Breadcrumb.Link href="https://alpha.nativebase.io/" isExternal>

0 commit comments

Comments
 (0)