@eohjsc/react-native-smart-city 0.4.46 → 0.4.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eohjsc/react-native-smart-city",
3
3
  "title": "React Native Smart Home",
4
- "version": "0.4.46",
4
+ "version": "0.4.47",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -147,7 +147,7 @@
147
147
  "pluralize": "^8.0.0",
148
148
  "postinstall": "^0.7.0",
149
149
  "precompiled-mqtt": "^4.3.14-beta",
150
- "pusher-js": "^7.4.0",
150
+ "pusher-js": "^8.0.2",
151
151
  "pusher-js-auth": "^4.0.1",
152
152
  "python-struct": "^1.1.3",
153
153
  "querystring": "^0.2.0",
@@ -698,18 +698,17 @@ describe('test DeviceDetail', () => {
698
698
  items: [
699
699
  {
700
700
  configuration: {
701
- template: 'OnOffSimpleActionTemplate',
702
- configuration: {
703
- config: 5,
704
- icon: 'up',
705
- is_on_value: [],
701
+ config: 131357,
702
+ config_data: {
703
+ sensor_id: 36700,
704
+ chip_id: 8296,
706
705
  },
707
706
  title: 'Turn on / off',
708
707
  },
709
708
  id: 18,
710
709
  order: 2,
711
- template: 'action',
712
- type: 'action',
710
+ template: 'OnOffSimpleActionTemplate',
711
+ type: 'OnOffSimpleActionTemplate',
713
712
  },
714
713
  ],
715
714
  };
@@ -330,9 +330,7 @@ const DeviceDetail = ({ route }) => {
330
330
 
331
331
  const listMenuItem = useMemo(() => {
332
332
  const menuItems = [];
333
- if (
334
- display.items.some((i) => getActionComponent(i.configuration.template))
335
- ) {
333
+ if (display.items.some((i) => getActionComponent(i.template))) {
336
334
  menuItems.push({
337
335
  route: Routes.ActivityLog,
338
336
  data: {
@@ -10,10 +10,13 @@ import Text from '../../../commons/Text';
10
10
  import { useRoute } from '@react-navigation/native';
11
11
  import { getTranslate } from '../../../utils/I18n';
12
12
  import { TouchableOpacity } from 'react-native';
13
+ import { GestureHandlerRootView } from 'react-native-gesture-handler';
13
14
 
14
15
  const wrapComponent = () => (
15
16
  <SCProvider initState={mockSCStore({})}>
16
- <EditTemplate />
17
+ <GestureHandlerRootView>
18
+ <EditTemplate />
19
+ </GestureHandlerRootView>
17
20
  </SCProvider>
18
21
  );
19
22
 
@@ -44,55 +47,55 @@ describe('Test EditTemplate', () => {
44
47
  ];
45
48
 
46
49
  it('Test render empty', async () => {
47
- // useRoute.mockReturnValue({
48
- // params: {},
49
- // });
50
- // await act(async () => {
51
- // tree = await create(wrapComponent());
52
- // });
53
- // const instance = tree.root;
54
- // const Texts = instance.findAllByType(Text);
55
- // expect(Texts[0].props.children).toBe(getTranslate('en', 'no_widgets'));
56
- // expect(Texts[1].props.children).toBe(getTranslate('en', 'add_your_widget'));
50
+ useRoute.mockReturnValue({
51
+ params: {},
52
+ });
53
+ await act(async () => {
54
+ tree = await create(wrapComponent());
55
+ });
56
+ const instance = tree.root;
57
+ const Texts = instance.findAllByType(Text);
58
+ expect(Texts[0].props.children).toBe(getTranslate('en', 'no_widgets'));
59
+ expect(Texts[1].props.children).toBe(getTranslate('en', 'add_your_widget'));
57
60
  });
58
61
 
59
- // it('Test render list widgets', async () => {
60
- // useRoute.mockReturnValue({
61
- // params: {
62
- // data,
63
- // setData: mockSetData,
64
- // },
65
- // });
66
- // await act(async () => {
67
- // tree = await create(wrapComponent());
68
- // });
69
- // const instance = tree.root;
70
- // const DraggableFlatLists = instance.findAllByType(DraggableFlatList);
71
- // expect(DraggableFlatLists).toHaveLength(1);
62
+ it('Test render list widgets', async () => {
63
+ useRoute.mockReturnValue({
64
+ params: {
65
+ data,
66
+ setData: mockSetData,
67
+ },
68
+ });
69
+ await act(async () => {
70
+ tree = await create(wrapComponent());
71
+ });
72
+ const instance = tree.root;
73
+ const DraggableFlatLists = instance.findAllByType(DraggableFlatList);
74
+ expect(DraggableFlatLists).toHaveLength(1);
72
75
 
73
- // const TouchableOpacities = instance.findAllByType(TouchableOpacity);
76
+ const TouchableOpacities = instance.findAllByType(TouchableOpacity);
74
77
 
75
- // await act(async () => {
76
- // await TouchableOpacities[0].props.onPress();
77
- // });
78
- // await act(async () => {
79
- // const firstItem = instance.findByProps({ accessibilityLabel: 'item-0' });
80
- // await firstItem.props.onLongPress();
81
- // });
78
+ await act(async () => {
79
+ await TouchableOpacities[0].props.onPress();
80
+ });
81
+ await act(async () => {
82
+ const firstItem = instance.findByProps({ accessibilityLabel: 'item-0' });
83
+ await firstItem.props.onLongPress();
84
+ });
82
85
 
83
- // expect(mockGoBack).toBeCalled();
86
+ expect(mockGoBack).toBeCalled();
84
87
 
85
- // mockGoBack.mockReset();
86
- // await act(async () => {
87
- // await DraggableFlatLists[0].props.onDragEnd({
88
- // data,
89
- // });
90
- // });
91
- // await act(async () => {
92
- // await instance
93
- // .findByProps({ accessibilityLabel: 'Save' })
94
- // .props.onPress();
95
- // });
96
- // expect(mockGoBack).toBeCalled();
97
- // });
88
+ mockGoBack.mockReset();
89
+ await act(async () => {
90
+ await DraggableFlatLists[0].props.onDragEnd({
91
+ data,
92
+ });
93
+ });
94
+ await act(async () => {
95
+ await instance
96
+ .findByProps({ accessibilityLabel: 'Save' })
97
+ .props.onPress();
98
+ });
99
+ expect(mockGoBack).toBeCalled();
100
+ });
98
101
  });