@eohjsc/react-native-smart-city 0.3.36 → 0.3.37

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.
Files changed (301) hide show
  1. package/package.json +1 -1
  2. package/src/commons/Action/__test__/ItemQuickAction.test.js +36 -32
  3. package/src/commons/ActionGroup/ColorPickerTemplate.js +61 -23
  4. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +2 -2
  5. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/ItemPasscode.test.js +1 -1
  6. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +1 -1
  7. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +2 -2
  8. package/src/commons/ActionGroup/SliderRangeTemplate.js +35 -20
  9. package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/CircleButton.test.js +12 -12
  10. package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/ControlPlay.test.js +10 -10
  11. package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/RectangleButton.test.js +7 -7
  12. package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/SmartTiviActionTemplate.test.js +23 -23
  13. package/src/commons/ActionGroup/StatesGridActionTemplate.js +1 -3
  14. package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +1 -1
  15. package/src/commons/ActionGroup/__test__/CurtainButtonTemplate.test.js +4 -4
  16. package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +14 -14
  17. package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +12 -12
  18. package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +2 -2
  19. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +10 -10
  20. package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +2 -2
  21. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +7 -7
  22. package/src/commons/ActionGroup/__test__/SliderRangeTemplate.test.js +1 -1
  23. package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +2 -2
  24. package/src/commons/ActionGroup/__test__/ThreeButtonTemplate.test.js +2 -2
  25. package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +3 -3
  26. package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +2 -2
  27. package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +14 -14
  28. package/src/commons/ActionGroup/__test__/index.test.js +41 -41
  29. package/src/commons/ActionTemplate/OnOffButtonAction.js +6 -4
  30. package/src/commons/ActionTemplate/OnOffSimpleAction.js +9 -3
  31. package/src/commons/ActionTemplate/OnOffSmartLockAction.js +12 -10
  32. package/src/commons/ActionTemplate/__test__/OnOffButtonAction.test.js +3 -3
  33. package/src/commons/ActionTemplate/__test__/OnOffSimpleAction.test.js +3 -3
  34. package/src/commons/ActionTemplate/__test__/OneButtonAction.test.js +3 -3
  35. package/src/commons/ActionTemplate/__test__/ThreeButtonAction.test.js +3 -3
  36. package/src/commons/ActionTemplate/__test__/index.test.js +6 -6
  37. package/src/commons/ActionTemplate/index.js +15 -3
  38. package/src/commons/Alert/__test__/Alert.test.js +2 -2
  39. package/src/commons/AlertAction/__test__/AlertAction.test.js +2 -2
  40. package/src/commons/Auth/__test__/AccountItem.test.js +4 -4
  41. package/src/commons/Auth/__test__/AccountList.test.js +4 -4
  42. package/src/commons/Auth/__test__/OtpInputList.test.js +20 -16
  43. package/src/commons/Auth/__test__/SocialButton.test.js +6 -6
  44. package/src/commons/Automate/__test__/ItemAutomate.test.js +2 -2
  45. package/src/commons/Automate/__test__/ItemScriptAction.test.js +2 -2
  46. package/src/commons/BackDefault/__test__/BackDefault.test.js +2 -2
  47. package/src/commons/Button/__test__/Button.test.js +3 -3
  48. package/src/commons/ButtonPopup/__test__/ButtonPopup.test.js +2 -2
  49. package/src/commons/Calendar/__test__/Calendar.test.js +2 -2
  50. package/src/commons/ChartLoading/__test__/ChartLoading.test.js +2 -2
  51. package/src/commons/CircleButton/__test__/CircleButton.test.js +2 -2
  52. package/src/commons/CircleView/__test__/CircleView.test.js +2 -2
  53. package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +3 -3
  54. package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +2 -2
  55. package/src/commons/DateTimeRangeChange/__test__/DateTimeButton.test.js +4 -4
  56. package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +5 -5
  57. package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +2 -2
  58. package/src/commons/Device/Hanet/ItemHanetDevice.test.js +5 -5
  59. package/src/commons/Device/LinearChart/LinearChart.test.js +2 -2
  60. package/src/commons/Device/RainningSensor/__test__/CurrentRainSensor.test.js +6 -6
  61. package/src/commons/Device/SonosSpeaker/__test__/SonosSpeaker.test.js +8 -8
  62. package/src/commons/Device/WindDirection/Compass/Compass.test.js +4 -4
  63. package/src/commons/Device/WindSpeed/LinearChart/__test__/LinearChart.test.js +2 -2
  64. package/src/commons/Device/WindSpeed/LinearChart/__test__/ValueBalloon.test.js +2 -2
  65. package/src/commons/Device/WindSpeed/__test__/Anemometer.test.js +4 -4
  66. package/src/commons/Device/WindSpeed/__test__/ChartInfo.test.js +5 -5
  67. package/src/commons/Device/__test__/ConnectedViewHeader.test.js +6 -6
  68. package/src/commons/Device/__test__/DeviceAlertStatus.test.js +6 -6
  69. package/src/commons/Device/__test__/DisconnectedView.test.js +12 -12
  70. package/src/commons/Device/__test__/FlatListItems.test.js +2 -2
  71. package/src/commons/Device/__test__/FooterInfo.test.js +2 -2
  72. package/src/commons/Device/__test__/SensorConnectedStatus.test.js +2 -2
  73. package/src/commons/DisplayChecking/__test__/DisplayChecking.test.js +2 -2
  74. package/src/commons/Explore/SearchBox/__test__/SearchBox.test.js +6 -6
  75. package/src/commons/Explore/__test__/CityItem.test.js +6 -6
  76. package/src/commons/Explore/__test__/HeaderExplore.test.js +2 -2
  77. package/src/commons/Explore/__test__/HeaderLabel.test.js +3 -3
  78. package/src/commons/Explore/__test__/LocationItem.test.js +3 -3
  79. package/src/commons/FieldTemplate/ChooseUserField/__test__/index.test.js +4 -4
  80. package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +2 -2
  81. package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +1 -1
  82. package/src/commons/Form/__test__/CurrencyInput.test.js +12 -12
  83. package/src/commons/Form/__test__/TextInput.test.js +4 -4
  84. package/src/commons/Form/__test__/TextInputPassword.test.js +5 -5
  85. package/src/commons/FourButtonFilterHistory/__test__/FourButtonFilterHistory.test.js +1 -1
  86. package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +12 -10
  87. package/src/commons/Header/__test__/HeaderCT.test.js +11 -11
  88. package/src/commons/ImageButton/__test__/ImageButton.test.js +2 -2
  89. package/src/commons/ImagePicker/__test__/ImagePicker.test.js +8 -8
  90. package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +1 -1
  91. package/src/commons/MediaPlayerDetail/__test__/MediaPlayerFull.test.js +8 -8
  92. package/src/commons/MenuActionAddnew/__test__/MenuActionAddNew.test.js +3 -3
  93. package/src/commons/MenuActionList/__test__/MenuActionList.test.js +3 -3
  94. package/src/commons/MenuActionMore/__test__/MenuActionMore.test.js +2 -2
  95. package/src/commons/Modal/__test__/ModalBottom.test.js +4 -4
  96. package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +39 -13
  97. package/src/commons/OneTapTemplate/OptionsDropdownActionTemplate.js +33 -14
  98. package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +9 -4
  99. package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +25 -12
  100. package/src/commons/OneTapTemplate/__test__/OptionsDropdownActionTemplate.test.js +13 -13
  101. package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +7 -7
  102. package/src/commons/PreventAccess/__test__/PreventAccess.test.js +7 -5
  103. package/src/commons/Processing/__test__/Connecting.test.js +61 -25
  104. package/src/commons/Processing/index.js +21 -7
  105. package/src/commons/RowItem/__test__/RowItem.test.js +2 -2
  106. package/src/commons/RowUser/__test__/RowUser.test.js +2 -2
  107. package/src/commons/SearchLocation/__test__/RowLocation.test.js +4 -4
  108. package/src/commons/Section/Section.test.js +4 -4
  109. package/src/commons/SelectSubUnit/__test__/SelectSubUnit.test.js +3 -3
  110. package/src/commons/SelectSubUnit/index.js +1 -1
  111. package/src/commons/SelectUnit/__test__/SelectUnit.test.js +3 -3
  112. package/src/commons/SelectUnit/index.js +3 -4
  113. package/src/commons/Sharing/__test__/BtnRemoveMember.test.js +3 -3
  114. package/src/commons/Sharing/__test__/ButtonRemoveMember.test.js +2 -2
  115. package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +3 -3
  116. package/src/commons/Sharing/__test__/MemberList.test.js +8 -8
  117. package/src/commons/Sharing/__test__/RowMember.test.js +4 -4
  118. package/src/commons/Sharing/__test__/StationDevicePermission.test.js +7 -7
  119. package/src/commons/Sharing/__test__/WrapHeaderScrollable.test.js +6 -6
  120. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +6 -6
  121. package/src/commons/SubUnit/__test__/Favorites.test.js +3 -3
  122. package/src/commons/SubUnit/__test__/Item.test.js +4 -4
  123. package/src/commons/SubUnit/__test__/ShortDetail.test.js +16 -16
  124. package/src/commons/SummaryItem/__test__/SummaryItem.test.js +7 -7
  125. package/src/commons/Tabbar/__test__/index.test.js +1 -1
  126. package/src/commons/TextButton/__test__/TextButton.test.js +6 -6
  127. package/src/commons/Today/__test__/Today.test.js +2 -2
  128. package/src/commons/TouchableScale/__test__/TouchableScale.test.js +5 -5
  129. package/src/commons/Unit/__test__/HeaderUnit.test.js +3 -3
  130. package/src/commons/Unit/__test__/SharedUnit.test.js +13 -13
  131. package/src/commons/UnitSummary/AirQuality/__test__/index.test.js +25 -25
  132. package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +258 -25
  133. package/src/commons/UnitSummary/ConfigHistoryChart/index.js +90 -1
  134. package/src/commons/UnitSummary/__test__/TotalPowerBox.test.js +2 -2
  135. package/src/commons/UnitSummary/__test__/TotalPowerConsumption.test.js +2 -2
  136. package/src/commons/ViewButtonBottom/__test__/ViewButtonBottom.test.js +3 -3
  137. package/src/commons/WheelDateTimePicker/__test__/index.test.js +2 -2
  138. package/src/commons/WrapParallaxScrollView/index.js +2 -1
  139. package/src/configs/API.js +6 -2
  140. package/src/configs/AccessibilityLabel.js +5 -0
  141. package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +2 -2
  142. package/src/hooks/Common/__test__/useStatusbar.test.js +4 -4
  143. package/src/hooks/Common/__test__/useTranslations.test.js +1 -1
  144. package/src/hooks/IoT/__test__/useRemoteControl.test.js +7 -7
  145. package/src/hooks/IoT/useRemoteControl.js +0 -1
  146. package/src/iot/RemoteControl/__test__/Bluetooth.test.js +17 -17
  147. package/src/iot/RemoteControl/__test__/Internet.test.js +4 -4
  148. package/src/screens/AQIGuide/__test__/AQIGuide.test.js +3 -3
  149. package/src/screens/ActivityLog/__test__/FilterPopup.test.js +2 -2
  150. package/src/screens/ActivityLog/__test__/ItemLog.test.js +21 -21
  151. package/src/screens/ActivityLog/hooks/__test__/index.test.js +1 -1
  152. package/src/screens/AddCommon/SelectUnit.js +1 -1
  153. package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +4 -4
  154. package/src/screens/AddCommon/__test__/SelectUnit.test.js +11 -6
  155. package/src/screens/AddLocationMaps/__test__/index.test.js +6 -6
  156. package/src/screens/AddNewAction/Device/__test__/index.test.js +3 -3
  157. package/src/screens/AddNewAction/SelectAction.js +6 -1
  158. package/src/screens/AddNewAction/__test__/SelectAction.test.js +128 -20
  159. package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +10 -10
  160. package/src/screens/AddNewAction/__test__/SetupSensor.test.js +8 -8
  161. package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +2 -2
  162. package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +8 -8
  163. package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +8 -8
  164. package/src/screens/AddNewGateway/ConnectingDevice.js +29 -7
  165. package/src/screens/AddNewGateway/ConnectingWifiGuide.js +2 -2
  166. package/src/screens/AddNewGateway/ConnectingZigbeeDevice.js +3 -2
  167. package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +5 -5
  168. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +6 -6
  169. package/src/screens/AddNewGateway/__test__/ConnectingModbusDevice.test.js +1 -1
  170. package/src/screens/AddNewGateway/__test__/ConnectingWifiDevice.test.js +1 -1
  171. package/src/screens/AddNewGateway/__test__/ConnectingWifiGuide.test.js +9 -9
  172. package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +1 -1
  173. package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +4 -4
  174. package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +4 -4
  175. package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +4 -4
  176. package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +4 -4
  177. package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +2 -2
  178. package/src/screens/AddNewGateway/__test__/SelectDeviceType.test.js +6 -6
  179. package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +1 -1
  180. package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +2 -2
  181. package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +2 -2
  182. package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +6 -6
  183. package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +4 -4
  184. package/src/screens/AllCamera/__test__/index.test.js +2 -2
  185. package/src/screens/Automate/__test__/Loading.test.js +2 -2
  186. package/src/screens/Automate/__test__/MultiUnits.test.js +10 -10
  187. package/src/screens/Automate/__test__/index.test.js +3 -3
  188. package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +2 -2
  189. package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +4 -4
  190. package/src/screens/Device/__test__/DetailHistoryChart.test.js +2 -2
  191. package/src/screens/Device/__test__/detail.test.js +14 -14
  192. package/src/screens/Device/detail.js +10 -3
  193. package/src/screens/Device/utils/index.test.js +4 -4
  194. package/src/screens/Drawer/Drawer.test.js +1 -1
  195. package/src/screens/EditActionsList/__tests__/index.test.js +5 -5
  196. package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +15 -15
  197. package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +19 -19
  198. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +12 -12
  199. package/src/screens/EmergencySetting/__test__/DropDownItem.test.js +7 -7
  200. package/src/screens/EmergencySetting/__test__/index.test.js +3 -3
  201. package/src/screens/EnterPassword/__test__/EnterPassword.test.js +12 -12
  202. package/src/screens/Explore/__test__/Explore.test.js +3 -3
  203. package/src/screens/GuestInfo/__test__/index.test.js +3 -3
  204. package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +2 -2
  205. package/src/screens/HanetCamera/__test__/Detail.test.js +2 -2
  206. package/src/screens/HanetCamera/__test__/ManageAccess.test.js +5 -5
  207. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +5 -5
  208. package/src/screens/HanetCamera/hooks/__test__/useHanetCheckinData.test.js +6 -6
  209. package/src/screens/HanetCamera/hooks/__test__/useHanetPlaceMembers.test.js +3 -3
  210. package/src/screens/ManageAccess/hooks/__test__/useManageAccess.test.js +11 -7
  211. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +1 -1
  212. package/src/screens/Notification/__test__/Notification.test.js +5 -5
  213. package/src/screens/Notification/__test__/NotificationItem.test.js +41 -41
  214. package/src/screens/PlayBackCamera/__test__/Timer.test.js +3 -3
  215. package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +7 -7
  216. package/src/screens/ScriptDetail/__test__/index.test.js +31 -31
  217. package/src/screens/SetSchedule/__test__/SelectWeekday.test.js +1 -1
  218. package/src/screens/SetSchedule/__test__/index.test.js +4 -4
  219. package/src/screens/SharedUnit/__test__/ShareUnit.test.js +2 -2
  220. package/src/screens/SharedUnit/__test__/TabHeader.test.js +3 -3
  221. package/src/screens/Sharing/Components/__test__/DeviceItem.test.js +4 -4
  222. package/src/screens/Sharing/Components/__test__/ItemChangeRole.test.js +4 -4
  223. package/src/screens/Sharing/Components/__test__/TitleCheckBox.test.js +4 -4
  224. package/src/screens/Sharing/__test__/MemberList.test.js +1 -1
  225. package/src/screens/Sharing/__test__/MemberList2.test.js +1 -1
  226. package/src/screens/Sharing/__test__/SelectPermission.test.js +41 -41
  227. package/src/screens/Sharing/__test__/SelectUser.test.js +14 -14
  228. package/src/screens/SideMenuDetail/__test__/index.test.js +25 -4
  229. package/src/screens/SideMenuDetail/index.js +32 -19
  230. package/src/screens/SmartAccount/ListDevice/__test__/DeviceItem.test.js +3 -3
  231. package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +13 -21
  232. package/src/screens/SmartAccount/ListDevice/index.js +1 -0
  233. package/src/screens/SmartAccount/SuccessfullyConnected/__test__/DeviceItem.test.js +6 -6
  234. package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +6 -5
  235. package/src/screens/SmartAccount/SuccessfullyConnected/index.js +1 -0
  236. package/src/screens/SmartAccount/__test__/Connecting.test.js +4 -4
  237. package/src/screens/SmartAccount/__test__/SmartAccount.test.js +17 -17
  238. package/src/screens/SmartIr/__test__/ButtonsBottom.test.js +2 -2
  239. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +12 -12
  240. package/src/screens/SmartIr/__test__/SelectBrand.test.js +5 -5
  241. package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +5 -5
  242. package/src/screens/SmartIr/__test__/SmartIr.test.js +5 -5
  243. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +12 -12
  244. package/src/screens/SubUnit/__test__/Detail.test.js +6 -6
  245. package/src/screens/SubUnit/__test__/EditSubUnit.test.js +44 -44
  246. package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +6 -6
  247. package/src/screens/SubUnit/hooks/__test__/useManageSubUnit.test.js +5 -5
  248. package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +10 -10
  249. package/src/screens/TDSGuide/__test__/TDSGuide.test.js +3 -3
  250. package/src/screens/UVIndexGuide/__test__/UVIndexGuide.test.js +3 -3
  251. package/src/screens/Unit/ManageUnit.js +4 -45
  252. package/src/screens/Unit/ManageUnitStyles.js +5 -35
  253. package/src/screens/Unit/Station/__test__/index.test.js +1 -1
  254. package/src/screens/Unit/Summaries.js +11 -20
  255. package/src/screens/Unit/__test__/AddMenu.test.js +8 -8
  256. package/src/screens/Unit/__test__/CheckSendEmail.test.js +3 -3
  257. package/src/screens/Unit/__test__/ChooseLocation.test.js +2 -2
  258. package/src/screens/Unit/__test__/Detail.test.js +17 -17
  259. package/src/screens/Unit/__test__/ManageUnit.test.js +17 -17
  260. package/src/screens/Unit/__test__/MyAllUnit.test.js +5 -5
  261. package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +4 -4
  262. package/src/screens/Unit/__test__/SelectAddress.test.js +10 -10
  263. package/src/screens/Unit/__test__/SmartAccount.test.js +4 -4
  264. package/src/screens/Unit/__test__/SmartAccountItem.test.js +1 -1
  265. package/src/screens/Unit/__test__/Summaries.test.js +2 -2
  266. package/src/screens/Unit/components/ButtonWrapper/index.js +60 -0
  267. package/src/screens/Unit/components/ButtonWrapper/styles.js +37 -0
  268. package/src/screens/Unit/components/MyAllUnit/__test__/Header.test.js +19 -19
  269. package/src/screens/Unit/components/MyAllUnit/__test__/MyAllUnit.test.js +3 -3
  270. package/src/screens/Unit/components/MyAllUnit/__test__/index.test.js +4 -4
  271. package/src/screens/Unit/components/__test__/Header.test.js +12 -12
  272. package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +2 -2
  273. package/src/screens/Unit/components/__test__/SharedUnit.test.js +6 -6
  274. package/src/screens/UnitSummary/__test__/index.test.js +24 -24
  275. package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +3 -3
  276. package/src/screens/UnitSummary/components/PowerConsumption/__test__/ItemPower.test.js +3 -3
  277. package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +5 -5
  278. package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +3 -3
  279. package/src/screens/UnitSummary/components/Temperature/__test__/ChartAverage.test.js +3 -3
  280. package/src/screens/UnitSummary/components/Temperature/__test__/ItemAverage.test.js +3 -3
  281. package/src/screens/UnitSummary/components/UvIndex/__test__/index.test.js +18 -18
  282. package/src/screens/UnitSummary/components/WaterQuality/__test__/index.test.js +12 -12
  283. package/src/screens/UnitSummary/components/__test__/TotalPowerBox.test.js +2 -2
  284. package/src/screens/UnitSummary/components/__test__/TotalPowerConsumption.test.js +2 -2
  285. package/src/screens/UnitSummary/components/__test__/UnitSummary.test.js +8 -8
  286. package/src/screens/UnitSummary/components/__test__/index.test.js +5 -5
  287. package/src/screens/WaterQualityGuide/__test__/index.test.js +12 -12
  288. package/src/utils/Apis/axios.js +22 -0
  289. package/src/utils/Converter/__test__/array.test.js +1 -1
  290. package/src/utils/Converter/__test__/url.test.js +1 -1
  291. package/src/utils/Functions/__test__/Search.test.js +1 -1
  292. package/src/utils/Functions/__test__/ShortEmail.test.js +1 -1
  293. package/src/utils/I18n/translations/en.json +3 -1
  294. package/src/utils/I18n/translations/vi.json +3 -1
  295. package/src/utils/__test__/InitData.test.js +2 -2
  296. package/src/utils/__test__/Utils.test.js +2 -2
  297. package/src/commons/UnitSummary/ConfigHistoryChart.js +0 -105
  298. package/src/screens/AddNewDevice/hooks/ConnectDevices.js +0 -67
  299. package/src/screens/AddNewDevice/hooks/useStateAlertRename.js +0 -32
  300. package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/__test__/index.test.js +0 -63
  301. package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/index.js +0 -53
@@ -22,7 +22,7 @@ const wrapComponent = (summaryDetail) => (
22
22
  describe('Test PowerConsumption', () => {
23
23
  let tree;
24
24
 
25
- test('render PowerConsumption', () => {
25
+ it('render PowerConsumption', async () => {
26
26
  const summaryDetail = {
27
27
  voltValue: 200,
28
28
  currentValue: 20,
@@ -31,7 +31,7 @@ describe('Test PowerConsumption', () => {
31
31
  totalPowerValue: 20,
32
32
  listConfigs: [1, 2, 3],
33
33
  };
34
- act(() => {
34
+ await act(async () => {
35
35
  tree = renderer.create(wrapComponent(summaryDetail));
36
36
  });
37
37
  const instance = tree.root;
@@ -74,7 +74,7 @@ describe('Test PowerConsumption', () => {
74
74
  expect(listIndicator.props.data).toEqual(resultList);
75
75
  });
76
76
 
77
- test('render PowerConsumption listConfigs.total_power', async () => {
77
+ it('render PowerConsumption listConfigs.total_power', async () => {
78
78
  const summaryDetail = {
79
79
  voltValue: 200,
80
80
  currentValue: 20,
@@ -100,7 +100,7 @@ describe('Test PowerConsumption', () => {
100
100
  expect(Todays).toBeDefined();
101
101
  });
102
102
 
103
- test('render with unsuccess fetch', async () => {
103
+ it('render with unsuccess fetch', async () => {
104
104
  const summaryDetail = {
105
105
  voltValue: 200,
106
106
  currentValue: 20,
@@ -125,7 +125,7 @@ describe('Test PowerConsumption', () => {
125
125
  expect(Todays).toBeDefined();
126
126
  });
127
127
 
128
- test('render without value', async () => {
128
+ it('render without value', async () => {
129
129
  const summaryDetail = {
130
130
  listConfigs: {
131
131
  active_power: 208,
@@ -80,14 +80,14 @@ describe('test RunningDevices', () => {
80
80
  expect(texts.length).toEqual(0);
81
81
 
82
82
  const button = instance.findAllByType(TouchableOpacity);
83
- act(() => {
83
+ await act(async () => {
84
84
  button[0].props.onPress();
85
85
  });
86
86
  expect(mockConnectHomeAssistant).toBeCalled();
87
87
  });
88
88
  });
89
89
 
90
- test('render RunningDevices remote_control_options.bluetooth', async () => {
90
+ it('render RunningDevices remote_control_options.bluetooth', async () => {
91
91
  let tree;
92
92
  let unit = {
93
93
  remote_control_options: {
@@ -119,7 +119,7 @@ describe('test RunningDevices', () => {
119
119
  expect(texts.length).toEqual(0);
120
120
 
121
121
  const button = instance.findAllByType(TouchableOpacity);
122
- act(() => {
122
+ await act(async () => {
123
123
  button[0].props.onPress();
124
124
  });
125
125
  expect(mockedNavigate).toBeCalledWith('DeviceDetail', {
@@ -6,9 +6,9 @@ import ChartAverage from '../ChartAverage';
6
6
 
7
7
  describe('Test ChartAverage', () => {
8
8
  let tree;
9
- test('render ChartAverage', () => {
10
- act(() => {
11
- tree = create(<ChartAverage />);
9
+ it('render ChartAverage', async () => {
10
+ await act(async () => {
11
+ tree = await create(<ChartAverage />);
12
12
  });
13
13
  const instance = tree.root;
14
14
  const Views = instance.findAllByType(View);
@@ -6,9 +6,9 @@ import ItemAverage from '../ItemAverage';
6
6
 
7
7
  describe('Test ItemAverage', () => {
8
8
  let tree;
9
- test('render ItemAverage', async () => {
10
- act(() => {
11
- tree = create(<ItemAverage />);
9
+ it('render ItemAverage', async () => {
10
+ await act(async () => {
11
+ tree = await create(<ItemAverage />);
12
12
  });
13
13
  const instance = tree.root;
14
14
  const Views = instance.findAllByType(View);
@@ -28,59 +28,59 @@ describe('Test UvIndex', () => {
28
28
  });
29
29
  let tree;
30
30
 
31
- test('render UvIndex', async () => {
32
- act(() => {
33
- tree = create(wrapComponent(data));
31
+ it('render UvIndex', async () => {
32
+ await act(async () => {
33
+ tree = await create(wrapComponent(data));
34
34
  });
35
35
  const instance = tree.root;
36
36
  const Sections = instance.findAllByType(Section);
37
37
  expect(Sections).toHaveLength(2);
38
38
  });
39
39
 
40
- test('render UvIndex with negative uv_value', async () => {
40
+ it('render UvIndex with negative uv_value', async () => {
41
41
  data.summaryDetail.uv_value = -1;
42
- act(() => {
43
- tree = create(wrapComponent(data));
42
+ await act(async () => {
43
+ tree = await create(wrapComponent(data));
44
44
  });
45
45
  const instance = tree.root;
46
46
  const Sections = instance.findAllByType(Section);
47
47
  expect(Sections).toHaveLength(2);
48
48
  });
49
49
 
50
- test('render UvIndex with high uv_value', async () => {
50
+ it('render UvIndex with high uv_value', async () => {
51
51
  data.summaryDetail.uv_value = 11;
52
- act(() => {
53
- tree = create(wrapComponent(data));
52
+ await act(async () => {
53
+ tree = await create(wrapComponent(data));
54
54
  });
55
55
  const instance = tree.root;
56
56
  const Sections = instance.findAllByType(Section);
57
57
  expect(Sections).toHaveLength(2);
58
58
  });
59
59
 
60
- test('render UvIndex with advices', async () => {
60
+ it('render UvIndex with advices', async () => {
61
61
  data.summaryDetail.advices = ['Amazing good chop'];
62
- act(() => {
63
- tree = create(wrapComponent(data));
62
+ await act(async () => {
63
+ tree = await create(wrapComponent(data));
64
64
  });
65
65
  const instance = tree.root;
66
66
  const Sections = instance.findAllByType(Section);
67
67
  expect(Sections).toHaveLength(2);
68
68
  });
69
69
 
70
- test('render UvIndex without advices', async () => {
70
+ it('render UvIndex without advices', async () => {
71
71
  delete data.summaryDetail.advices;
72
- act(() => {
73
- tree = create(wrapComponent(data));
72
+ await act(async () => {
73
+ tree = await create(wrapComponent(data));
74
74
  });
75
75
  const instance = tree.root;
76
76
  const Sections = instance.findAllByType(Section);
77
77
  expect(Sections).toHaveLength(2);
78
78
  });
79
79
 
80
- test('render UvIndex with undefined uv_value', async () => {
80
+ it('render UvIndex with undefined uv_value', async () => {
81
81
  data.summaryDetail.uv_value = undefined;
82
- act(() => {
83
- tree = create(wrapComponent(data));
82
+ await act(async () => {
83
+ tree = await create(wrapComponent(data));
84
84
  });
85
85
  const instance = tree.root;
86
86
  const Sections = instance.findAllByType(Section);
@@ -42,36 +42,36 @@ describe('Test WaterQualityGuide', () => {
42
42
  });
43
43
  let tree;
44
44
 
45
- test('render WaterQualityGuide', async () => {
46
- act(() => {
47
- tree = create(wrapComponent(data));
45
+ it('render WaterQualityGuide', async () => {
46
+ await act(async () => {
47
+ tree = await create(wrapComponent(data));
48
48
  });
49
49
  const instance = tree.root;
50
50
  const sections = instance.findAllByType(Section);
51
51
  expect(sections).toHaveLength(2);
52
52
  });
53
53
 
54
- test('render WaterQuality without showBoxHistory', async () => {
54
+ it('render WaterQuality without showBoxHistory', async () => {
55
55
  data.summaryDetail.ph_id = 0;
56
56
  data.summaryDetail.tur_id = 0;
57
57
  data.summaryDetail.clo_id = 0;
58
- act(() => {
59
- tree = create(wrapComponent(data));
58
+ await act(async () => {
59
+ tree = await create(wrapComponent(data));
60
60
  });
61
61
  const instance = tree.root;
62
62
  const sections = instance.findAllByType(Section);
63
63
  expect(sections).toHaveLength(1);
64
64
  });
65
65
 
66
- test('onClickItem waterType', async () => {
67
- act(() => {
68
- tree = create(wrapComponent(data));
66
+ it('onClickItem waterType', async () => {
67
+ await act(async () => {
68
+ tree = await create(wrapComponent(data));
69
69
  });
70
70
  const instance = tree.root;
71
71
  const buttons = instance.findAllByType(TouchableOpacity);
72
72
  expect(buttons).toHaveLength(5);
73
73
 
74
- act(() => {
74
+ await act(async () => {
75
75
  buttons[0].props.onPress();
76
76
  });
77
77
  expect(mockedNavigate).toHaveBeenCalledTimes(1);
@@ -79,7 +79,7 @@ describe('Test WaterQualityGuide', () => {
79
79
  waterType: 'turbidity',
80
80
  });
81
81
 
82
- act(() => {
82
+ await act(async () => {
83
83
  buttons[1].props.onPress();
84
84
  });
85
85
  expect(mockedNavigate).toHaveBeenCalledTimes(2);
@@ -87,7 +87,7 @@ describe('Test WaterQualityGuide', () => {
87
87
  waterType: 'ph',
88
88
  });
89
89
 
90
- act(() => {
90
+ await act(async () => {
91
91
  buttons[2].props.onPress();
92
92
  });
93
93
  expect(mockedNavigate).toHaveBeenCalledTimes(3);
@@ -6,8 +6,8 @@ import TotalPowerBox from '../TotalPowerBox';
6
6
  describe('Test Total Power Box', () => {
7
7
  let tree;
8
8
 
9
- test('render Total Power Box', () => {
10
- act(() => {
9
+ it('render Total Power Box', async () => {
10
+ await act(async () => {
11
11
  tree = renderer.create(<TotalPowerBox title={'titleTest'} />);
12
12
  });
13
13
  const instance = tree.root;
@@ -18,8 +18,8 @@ const wrapComponent = () => (
18
18
  describe('Test Total Power Consumption', () => {
19
19
  let tree;
20
20
 
21
- test('render Total Power Consumption', () => {
22
- act(() => {
21
+ it('render Total Power Consumption', async () => {
22
+ await act(async () => {
23
23
  tree = renderer.create(wrapComponent());
24
24
  });
25
25
  const instance = tree.root;
@@ -18,8 +18,8 @@ describe('Test UnitSummary', () => {
18
18
  };
19
19
 
20
20
  it('Test index = 0', async () => {
21
- await act(() => {
22
- tree = create(<UnitSummary {...defaultProps} index={0} />);
21
+ await act(async () => {
22
+ tree = await create(<UnitSummary {...defaultProps} index={0} />);
23
23
  });
24
24
  const instance = tree.root;
25
25
  const TouchableOpacities = instance.findAllByType(TouchableOpacity);
@@ -30,8 +30,8 @@ describe('Test UnitSummary', () => {
30
30
  });
31
31
 
32
32
  it('Test index = 1', async () => {
33
- await act(() => {
34
- tree = create(<UnitSummary {...defaultProps} index={1} />);
33
+ await act(async () => {
34
+ tree = await create(<UnitSummary {...defaultProps} index={1} />);
35
35
  });
36
36
  const instance = tree.root;
37
37
  const TouchableOpacities = instance.findAllByType(TouchableOpacity);
@@ -42,8 +42,8 @@ describe('Test UnitSummary', () => {
42
42
  });
43
43
 
44
44
  it('Test len % 2 === 0 && index = len - 1', async () => {
45
- await act(() => {
46
- tree = create(<UnitSummary {...defaultProps} index={1} len={2} />);
45
+ await act(async () => {
46
+ tree = await create(<UnitSummary {...defaultProps} index={1} len={2} />);
47
47
  });
48
48
  const instance = tree.root;
49
49
  const TouchableOpacities = instance.findAllByType(TouchableOpacity);
@@ -54,8 +54,8 @@ describe('Test UnitSummary', () => {
54
54
  });
55
55
 
56
56
  it('Test len % 2 !== 0 && index = len - 1', async () => {
57
- await act(() => {
58
- tree = create(<UnitSummary {...defaultProps} index={2} len={3} />);
57
+ await act(async () => {
58
+ tree = await create(<UnitSummary {...defaultProps} index={2} len={3} />);
59
59
  });
60
60
  const instance = tree.root;
61
61
  const TouchableOpacities = instance.findAllByType(TouchableOpacity);
@@ -6,14 +6,14 @@ import UnitSummary from '..';
6
6
  describe('UnitSummary components', () => {
7
7
  let tree;
8
8
 
9
- test('test render UnitSummary components', () => {
9
+ it('test render UnitSummary components', async () => {
10
10
  const summary = {
11
11
  left_value: 'left_value test',
12
12
  left_text: 'left_text test',
13
13
  right_value: 'right_value test',
14
14
  right_text: 'right_text test',
15
15
  };
16
- act(() => {
16
+ await act(async () => {
17
17
  tree = renderer.create(<UnitSummary summary={summary} />);
18
18
  });
19
19
  const instance = tree.root;
@@ -25,7 +25,7 @@ describe('UnitSummary components', () => {
25
25
  expect(textElement[3].props.children).toEqual(summary.right_text);
26
26
  });
27
27
 
28
- test('test onPress goToSummary', () => {
28
+ it('test onPress goToSummary', async () => {
29
29
  const summary = {
30
30
  left_value: 'left_value test',
31
31
  left_text: 'left_text test',
@@ -33,14 +33,14 @@ describe('UnitSummary components', () => {
33
33
  right_text: 'right_text test',
34
34
  };
35
35
  const mockFuntion = jest.fn();
36
- act(() => {
36
+ await act(async () => {
37
37
  tree = renderer.create(
38
38
  <UnitSummary summary={summary} goToSummary={mockFuntion} />
39
39
  );
40
40
  });
41
41
  const instance = tree.root;
42
42
  const touchableOpacity = instance.findByType(TouchableOpacity);
43
- act(() => {
43
+ await act(async () => {
44
44
  touchableOpacity.props.onPress();
45
45
  });
46
46
  expect(mockFuntion).toHaveBeenCalled();
@@ -102,9 +102,9 @@ describe('Test WaterQualityGuide', () => {
102
102
 
103
103
  let tree;
104
104
 
105
- test('render WaterQualityGuide default turbidityGuide', async () => {
106
- act(() => {
107
- tree = create(wrapComponent(route));
105
+ it('render WaterQualityGuide default turbidityGuide', async () => {
106
+ await act(async () => {
107
+ tree = await create(wrapComponent(route));
108
108
  });
109
109
  const instance = tree.root;
110
110
 
@@ -130,10 +130,10 @@ describe('Test WaterQualityGuide', () => {
130
130
  expect(textDescriptionLevel1).toHaveLength(0);
131
131
  });
132
132
 
133
- test('render WaterQualityGuide with turbidityGuide', async () => {
133
+ it('render WaterQualityGuide with turbidityGuide', async () => {
134
134
  route.params.waterType = 'turbidity';
135
- act(() => {
136
- tree = create(wrapComponent(route));
135
+ await act(async () => {
136
+ tree = await create(wrapComponent(route));
137
137
  });
138
138
  const instance = tree.root;
139
139
 
@@ -159,10 +159,10 @@ describe('Test WaterQualityGuide', () => {
159
159
  expect(textDescriptionLevel1).toHaveLength(0);
160
160
  });
161
161
 
162
- test('render WaterQualityGuide with cloGuide', async () => {
162
+ it('render WaterQualityGuide with cloGuide', async () => {
163
163
  route.params.waterType = 'clo';
164
- act(() => {
165
- tree = create(wrapComponent(route));
164
+ await act(async () => {
165
+ tree = await create(wrapComponent(route));
166
166
  });
167
167
  const instance = tree.root;
168
168
 
@@ -188,10 +188,10 @@ describe('Test WaterQualityGuide', () => {
188
188
  expect(textDescriptionLevel1).toHaveLength(0);
189
189
  });
190
190
 
191
- test('render WaterQualityGuide with phGuide', async () => {
191
+ it('render WaterQualityGuide with phGuide', async () => {
192
192
  route.params.waterType = 'ph';
193
- act(() => {
194
- tree = create(wrapComponent(route));
193
+ await act(async () => {
194
+ tree = await create(wrapComponent(route));
195
195
  });
196
196
  const instance = tree.root;
197
197
 
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-console */
1
2
  import { create } from 'apisauce';
2
3
  import { getData, storeData } from '../Storage';
3
4
  import { ToastBottomHelper } from '../Utils';
@@ -14,6 +15,27 @@ const api = create({
14
15
  timeout: 30000,
15
16
  });
16
17
 
18
+ if (__DEV__ && process.env.NODE_ENV !== 'test') {
19
+ api.axiosInstance.interceptors.request.use((request) => {
20
+ console.log(`${request.method.toUpperCase()} ${request.url || ''}`);
21
+ if (process.env.DEBUG_AXIOS_DETAIL_REQUEST) {
22
+ if (request.data) {
23
+ console.log(JSON.stringify(request.data));
24
+ }
25
+ console.log(request.headers);
26
+ }
27
+ return request;
28
+ });
29
+
30
+ api.axiosInstance.interceptors.response.use((response) => {
31
+ console.log(`${response.status} ${response.config.url}`);
32
+ if (process.env.DEBUG_AXIOS_DETAIL_REQUEST) {
33
+ console.log(response.data);
34
+ }
35
+ return response;
36
+ });
37
+ }
38
+
17
39
  const parseErrorResponse = async (error) => {
18
40
  let message;
19
41
  let data = {};
@@ -1,6 +1,6 @@
1
1
  import { removeDuplicateSearch } from '../array';
2
2
 
3
- test('test removeDuplicateSearch', () => {
3
+ it('test removeDuplicateSearch', async () => {
4
4
  let recentSearch = [
5
5
  { description: 'a' },
6
6
  { description: 'b' },
@@ -1,6 +1,6 @@
1
1
  import { queryStringToPath } from '../url';
2
2
 
3
- test('test queryStringToPath', () => {
3
+ it('test queryStringToPath', async () => {
4
4
  const oldUrl =
5
5
  // eslint-disable-next-line max-len
6
6
  'app://eoh/sync-lg-device?state=1&code=CODE&user_number=VN2106012039192&oauth2_backend_url=https%3A%2F%2Fkr.lgeapi.com%2F';
@@ -1,6 +1,6 @@
1
1
  const { convertToSlug } = require('../Search');
2
2
 
3
- it('Test Search function', () => {
3
+ it('Test Search function', async () => {
4
4
  const data = convertToSlug('Bệnh viện');
5
5
  expect(data).toEqual('benh vien');
6
6
  });
@@ -1,6 +1,6 @@
1
1
  import { shortEmailName } from '../ShortEmail';
2
2
 
3
- it('Test shortEmailName function', () => {
3
+ it('Test shortEmailName function', async () => {
4
4
  const data = shortEmailName('emailExample@gmail.com');
5
5
  expect(data).toEqual('emailExample');
6
6
  });
@@ -1007,7 +1007,7 @@
1007
1007
  "no_widgets": "No Widgets",
1008
1008
  "add_your_widget": "Add your widget in dashboard template",
1009
1009
  "label": "Label",
1010
- "choose_type_of_device": "Choose type of device",
1010
+ "choose_type_of_device": "Choose Type of Device",
1011
1011
  "central_controller": "Central controller",
1012
1012
  "wifi_device": "Wifi device",
1013
1013
  "device_connect_without_gateway": "Connecting device without gateway",
@@ -1040,5 +1040,7 @@
1040
1040
  "turn_on_device_to_connect": "Turn on device to connect",
1041
1041
  "turn_on_zigbee_device_content": "Power ON the device and keep the device connected to the router. Make sure the end device still ON",
1042
1042
  "read_device_manual_guide": "Read Device's manual guide for more details.",
1043
+ "fail_to_discover_device_wifi": "Fail to discover device wifi",
1044
+ "try_to_turn_on_device_or_try_again": "Try to turn on device or Try again",
1043
1045
  "click_here_to_setup_device": "Click here to setup device"
1044
1046
  }
@@ -1004,7 +1004,7 @@
1004
1004
  "add_widget": "Thêm tiện ích con",
1005
1005
  "add_your_widget": "Thêm tiện ích của bạn vào mẫu trang tổng quan",
1006
1006
  "label": "Nhãn",
1007
- "choose_type_of_device": "Chọn loại thiết bị",
1007
+ "choose_type_of_device": "Chọn Loại Thiết bị",
1008
1008
  "central_controller": "Bộ điều khiển trung tâm",
1009
1009
  "wifi_device": "Thiết bị wifi",
1010
1010
  "device_connect_without_gateway": "Kết nối thiết bị không có gateway",
@@ -1038,5 +1038,7 @@
1038
1038
  "turn_on_device_to_connect": "Bật thiết bị để kết nối",
1039
1039
  "turn_on_zigbee_device_content": "BẬT nguồn thiết bị và giữ thiết bị kết nối với bộ định tuyến. Đảm bảo thiết bị cuối vẫn BẬT",
1040
1040
  "read_device_manual_guide": "Đọc hướng dẫn sử dụng của Thiết bị để biết thêm chi tiết.",
1041
+ "fail_to_discover_device_wifi": "Không phát hiện được wifi của thiết bị",
1042
+ "try_to_turn_on_device_or_try_again": "Thử bật thiết bị hoặc Thử lại",
1041
1043
  "click_here_to_setup_device": "Chọn thiết bị thêm vào phòng"
1042
1044
  }
@@ -8,12 +8,12 @@ describe('Test initData', () => {
8
8
  Sentry.setUser.mockClear();
9
9
  });
10
10
 
11
- it('Test initData when has user', () => {
11
+ it('Test initData when has user', async () => {
12
12
  initData({ token: 1, user: { id: 1 } });
13
13
  expect(Sentry.setUser).toBeCalledWith({ id: 1 });
14
14
  });
15
15
 
16
- it('Test initData when has no user', () => {
16
+ it('Test initData when has no user', async () => {
17
17
  initData({ token: 1 });
18
18
  expect(Sentry.setUser).not.toBeCalled();
19
19
  });
@@ -1,11 +1,11 @@
1
1
  import { validateEmail, formatMoney } from '../Utils';
2
2
 
3
3
  describe('Test utils', () => {
4
- test('test validateEmail', () => {
4
+ it('test validateEmail', async () => {
5
5
  const result = validateEmail('eoh.2020@gmail.com');
6
6
  expect(result).toEqual(true);
7
7
  });
8
- test('test formatMoney', () => {
8
+ it('test formatMoney', async () => {
9
9
  const result = formatMoney(10000);
10
10
  expect(result).toEqual('10.000 đ');
11
11
  });
@@ -1,105 +0,0 @@
1
- import React, { memo, useEffect, useState } from 'react';
2
- import moment from 'moment';
3
-
4
- import { API } from '../../configs';
5
- import HistoryChart from '../../commons/Device/HistoryChart';
6
- import { axiosGet } from '../../utils/Apis/axios';
7
-
8
- export const dateTimeType = {
9
- date: 'date',
10
- time: 'time',
11
- dateTime: 'datetime',
12
- };
13
-
14
- const ConfigHistoryChart = memo(({ configs }) => {
15
- const [chartData, setChartData] = useState(configs);
16
- const [startDate, setStartDate] = useState(moment().subtract(1, 'days'));
17
- const [endDate, setEndDate] = useState(moment());
18
-
19
- useEffect(() => {
20
- const fetchDataS3 = (url) => {
21
- return (
22
- axiosGet(url, {
23
- transformRequest: (rq, headers) => {
24
- delete headers.Authorization;
25
- return rq;
26
- },
27
- })
28
- // eslint-disable-next-line promise/prefer-await-to-then
29
- .then((response) => {
30
- return response.data;
31
- })
32
- // eslint-disable-next-line promise/prefer-await-to-callbacks
33
- .catch((error) => {})
34
- );
35
- };
36
-
37
- const fetchData = async () => {
38
- let params = new URLSearchParams();
39
- let configuration = configs.filter((item) => item.id);
40
- configuration.map((item) => {
41
- params.append('config', item.id);
42
- });
43
- params.append('date_from', startDate.unix());
44
- params.append('date_to', endDate.unix());
45
-
46
- const { success, data } = await axiosGet(API.CONFIG.DISPLAY_HISTORY(), {
47
- params,
48
- });
49
- if (success) {
50
- let urls = [];
51
- data.forEach((config) => {
52
- config.data.forEach((value_log) => {
53
- if (value_log.url) {
54
- urls.push(value_log.url);
55
- } else {
56
- value_log.x = moment(value_log.x).toDate();
57
- }
58
- });
59
- });
60
-
61
- // eslint-disable-next-line promise/prefer-await-to-then
62
- Promise.all(urls.map(fetchDataS3)).then((result) => {
63
- let s3_data = [].concat.apply(
64
- [],
65
- result.filter((r) => r.length > 0)
66
- );
67
- s3_data.forEach((value_log) => {
68
- value_log.x = moment(value_log.start_time).toDate();
69
- value_log.y = value_log.converted_value_log;
70
- });
71
- setChartData(
72
- configuration.map((config) => {
73
- let s3_config_data = [].concat.apply(
74
- [],
75
- s3_data.filter((x) => x.config_id === config.id)
76
- );
77
- let config_data = data.find((k) => k.config === config.id).data;
78
- config_data = config_data.filter((k) => !('url' in k));
79
- config.data = [...s3_config_data, ...config_data];
80
- config.data = config.data.sort((a, b) => a.x > b.x);
81
- return config;
82
- })
83
- );
84
- });
85
- }
86
- };
87
- fetchData();
88
- // eslint-disable-next-line react-hooks/exhaustive-deps
89
- }, [startDate, endDate]);
90
-
91
- if (!chartData.length) {
92
- return false;
93
- }
94
-
95
- return (
96
- <HistoryChart
97
- configuration={{ type: 'line_chart', date_format: 'DD.MM' }}
98
- datas={chartData}
99
- setStartDate={setStartDate}
100
- setEndDate={setEndDate}
101
- />
102
- );
103
- });
104
-
105
- export default ConfigHistoryChart;