Repository: DevExpress/devextreme-react
Pull request #502 (2021-02-15 16:50:50)

Update internal-tools version


Patch:
diff --git a/README.md b/README.md
index aa39ee5..5e5aa14 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 # DevExtreme React UI Components #
 
-[![Build Status](https://img.shields.io/shippable/5a9532d976382b0800e7a53c/master.svg?maxAge=43200)](https://app.shippable.com/github/DevExpress/devextreme-react)
+[![Build Status](https://api.shippable.com/projects/5a9532d976382b0800e7a53c/badge?branch=master)](https://app.shippable.com/github/DevExpress/devextreme-react)
 [![NPM](https://img.shields.io/npm/v/devextreme-react.svg?maxAge=43200)](https://www.npmjs.com/package/devextreme-react)
 
 This project allows you to use [DevExtreme widgets](http://js.devexpress.com/Demos/WidgetsGallery/) in [React](https://reactjs.org) applications.
diff --git a/package.json b/package.json
index da58f3f..435e844 100644
--- a/package.json
+++ b/package.json
@@ -13,7 +13,7 @@
     "@typescript-eslint/parser": "^4.4.1",
     "cpy-cli": "^3.1.1",
     "del-cli": "^3.0.1",
-    "devextreme-internal-tools": "stable",
+    "devextreme-internal-tools": "^4.0.0",
     "eslint": "^7.11.0",
     "eslint-config-airbnb-base": "^14.2.0",
     "eslint-config-airbnb-typescript": "^11.4.0",
diff --git a/packages/devextreme-react/src/core/configuration/tree.ts b/packages/devextreme-react/src/core/configuration/tree.ts
index 9f74b7c..3b40dea 100644
--- a/packages/devextreme-react/src/core/configuration/tree.ts
+++ b/packages/devextreme-react/src/core/configuration/tree.ts
@@ -81,7 +81,7 @@ enum ValueType {
   Array,
 }
 
-function findValueInObject(obj: any, path: string[]): undefined | IValueDescriptor {
+function findValueInObject(obj: unknown, path: string[]): undefined | IValueDescriptor {
   const key = path.shift();
   if (!key) {
     return {
@@ -90,7 +90,7 @@ function findValueInObject(obj: any, path: string[]): undefined | IValueDescript
     };
   }
 
-  if (Object.keys(obj).includes(key)) {
+  if (obj instanceof Object && Object.keys(obj).includes(key)) {
     return findValueInObject(obj[key], path);
   }
 
@@ -156,4 +156,5 @@ export {
   buildNode,
   buildTemplates,
   findValue,
+  findValueInObject
 };


Test patch:
diff --git a/packages/devextreme-react/src/core/configuration/__tests__/tree.test.ts b/packages/devextreme-react/src/core/configuration/__tests__/tree.test.ts
new file mode 100644
index 0000000..d7688bb
--- /dev/null
+++ b/packages/devextreme-react/src/core/configuration/__tests__/tree.test.ts
@@ -0,0 +1,31 @@
+/* eslint-disable max-classes-per-file */
+import { findValueInObject } from '../tree';
+
+describe('check findValueInObject', () => {
+
+    it("get underfined by string", () => {
+        const obj = "Extension";
+        const path = ["sortOrder"];
+        const valueInObject = findValueInObject(obj, path);
+        expect(() => findValueInObject(obj, path)).not.toThrow();
+        expect(valueInObject).toEqual(undefined);
+    });
+
+    it("get value by object", () => {
+        const obj = {
+            "sortOrder": "desc"
+        }
+        const path = ["sortOrder"];
+        const valueInObject = findValueInObject(obj, path);
+        expect(valueInObject).toEqual({ "type": 0, "value": "desc" });
+        expect(() => findValueInObject(obj, path)).not.toThrow();
+    })
+
+    it("get underfined by empty object",() =>{
+        const obj = {}
+        const path = ["sortOrder"];
+        const valueInObject = findValueInObject(obj, path);
+        expect(valueInObject).toEqual(undefined);
+        expect(() => findValueInObject(obj, path)).not.toThrow();
+    })
+})