-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move isNodeRecordWithChildren to nodeUtils; add test * Add test * Extract loadChildrenFromData * Set isEmptyFolder to true when the data contains children: [] * Build * Lint * Changelog
- Loading branch information
Showing
13 changed files
with
281 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
"use strict"; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.isNodeRecordWithChildren = void 0; | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
var isNodeRecordWithChildren = exports.isNodeRecordWithChildren = function isNodeRecordWithChildren(data) { | ||
return _typeof(data) === "object" && "children" in data && data["children"] instanceof Array; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"use strict"; | ||
|
||
var _nodeUtils = require("../nodeUtils"); | ||
describe("isNodeRecordWithChildren", function () { | ||
it("returns true when the data is an object with the children attribute of type array", function () { | ||
var data = { | ||
children: [] | ||
}; | ||
expect((0, _nodeUtils.isNodeRecordWithChildren)(data)).toBe(true); | ||
}); | ||
it("returns when the data is an object without the children attribute", function () { | ||
var data = { | ||
name: "test" | ||
}; | ||
expect((0, _nodeUtils.isNodeRecordWithChildren)(data)).toBe(false); | ||
}); | ||
it("returns when the data is a string", function () { | ||
expect((0, _nodeUtils.isNodeRecordWithChildren)("test")).toBe(false); | ||
}); | ||
}); |
Oops, something went wrong.