js-build-tools 2.4.0 → 3.0.1

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 (204) hide show
  1. package/README.md +334 -205
  2. package/dist/build.js +59 -48
  3. package/dist/build.min.js +1 -1
  4. package/dist/bundle.js +12 -13
  5. package/dist/bundle.min.js +1 -1
  6. package/dist/bundleLint.js +17 -18
  7. package/dist/bundleLint.min.js +1 -1
  8. package/dist/bundleMinify.js +8 -9
  9. package/dist/bundleMinify.min.js +1 -1
  10. package/dist/copyFonts.js +12 -0
  11. package/dist/copyFonts.min.js +1 -0
  12. package/dist/default.js +1 -1
  13. package/dist/default.min.js +1 -1
  14. package/dist/dist.js +7 -8
  15. package/dist/distLint.js +17 -18
  16. package/dist/distLint.min.js +1 -1
  17. package/dist/distMinify.js +8 -9
  18. package/dist/distMinify.min.js +1 -1
  19. package/dist/images.js +11 -0
  20. package/dist/images.min.js +1 -0
  21. package/dist/partials/addToReadme.js +13 -14
  22. package/dist/partials/beginWatcher.js +9 -10
  23. package/dist/partials/clean.js +10 -11
  24. package/dist/partials/copyFor.js +16 -0
  25. package/dist/partials/distFor.js +16 -17
  26. package/dist/partials/distForSrc.js +9 -10
  27. package/dist/partials/distSeries.js +19 -20
  28. package/dist/partials/imagesFor.js +34 -0
  29. package/dist/partials/minifyFor.js +15 -16
  30. package/dist/partials/readmeTemplate.js +11 -12
  31. package/dist/partials/removeDirectory.js +11 -12
  32. package/dist/partials/runOnChange.js +27 -27
  33. package/dist/partials/sassFor.js +20 -21
  34. package/dist/partials/tsFor.js +20 -21
  35. package/dist/partials.js +35 -31
  36. package/dist/partials.min.js +1 -1
  37. package/dist/test-helpers/setUp.js +52 -60
  38. package/dist/testFull.js +17 -18
  39. package/dist/testFull.min.js +1 -1
  40. package/dist/testHelpers.js +10 -28
  41. package/dist/testHelpers.min.js +1 -1
  42. package/dist/testQuick.js +19 -20
  43. package/dist/testQuick.min.js +1 -1
  44. package/dist/typeScript.js +7 -8
  45. package/dist/utilities/dotGet.js +50 -0
  46. package/dist/utilities/dotNotate.js +77 -0
  47. package/dist/utilities/dotSet.js +44 -0
  48. package/dist/utilities/isObject.js +10 -0
  49. package/dist/utilities/strAfter.js +14 -0
  50. package/dist/utilities/strBefore.js +14 -0
  51. package/dist/watchFull.js +10 -11
  52. package/dist/watchTest.js +13 -14
  53. package/dist/watchTest.min.js +1 -1
  54. package/functions/build.js +15 -5
  55. package/functions/build.test.js +278 -42
  56. package/functions/bundle.js +3 -4
  57. package/functions/bundle.test.js +6 -6
  58. package/functions/bundleLint.js +2 -3
  59. package/functions/bundleLint.test.js +5 -5
  60. package/functions/bundleMinify.js +1 -2
  61. package/functions/bundleMinify.test.js +1 -1
  62. package/functions/copyFonts.js +11 -0
  63. package/functions/copyFonts.test.js +31 -0
  64. package/functions/default.js +1 -1
  65. package/functions/default.test.js +2 -2
  66. package/functions/dist.js +0 -1
  67. package/functions/dist.test.js +1 -1
  68. package/functions/distLint.js +2 -3
  69. package/functions/distLint.test.js +3 -3
  70. package/functions/distMinify.js +1 -2
  71. package/functions/distMinify.test.js +1 -1
  72. package/functions/images.js +10 -0
  73. package/functions/images.test.js +138 -0
  74. package/functions/partials/addToReadme.js +2 -3
  75. package/functions/partials/addToReadme.test.js +2 -2
  76. package/functions/partials/beginWatcher.js +1 -2
  77. package/functions/partials/beginWatcher.test.js +1 -1
  78. package/functions/partials/clean.js +0 -1
  79. package/functions/partials/copyFor.js +13 -0
  80. package/functions/partials/copyFor.test.js +34 -0
  81. package/functions/partials/distFor.js +1 -2
  82. package/functions/partials/distFor.test.js +4 -4
  83. package/functions/partials/distForSrc.js +3 -4
  84. package/functions/partials/distForSrc.test.js +6 -6
  85. package/functions/partials/distSeries.js +2 -3
  86. package/functions/partials/distSeries.test.js +5 -5
  87. package/functions/partials/imagesFor.js +33 -0
  88. package/functions/partials/imagesFor.test.js +143 -0
  89. package/functions/partials/minifyFor.js +0 -1
  90. package/functions/partials/minifyFor.test.js +1 -1
  91. package/functions/partials/readmeTemplate.js +3 -4
  92. package/functions/partials/readmeTemplate.test.js +2 -2
  93. package/functions/partials/removeDirectory.js +0 -1
  94. package/functions/partials/runOnChange.js +5 -6
  95. package/functions/partials/runOnChange.test.js +9 -9
  96. package/functions/partials/sassFor.js +1 -2
  97. package/functions/partials/sassFor.test.js +3 -3
  98. package/functions/partials/tsFor.js +3 -4
  99. package/functions/partials/tsFor.test.js +2 -2
  100. package/functions/partials.js +5 -1
  101. package/functions/partials.test.js +1 -1
  102. package/functions/sass.test.js +2 -2
  103. package/functions/test-helpers/setUp.js +24 -32
  104. package/functions/testFull.js +2 -3
  105. package/functions/testFull.test.js +1 -1
  106. package/functions/testHelpers.js +3 -20
  107. package/functions/testHelpers.test.js +1 -1
  108. package/functions/testQuick.js +1 -2
  109. package/functions/testQuick.test.js +1 -1
  110. package/functions/typeScript.js +0 -1
  111. package/functions/typeScript.test.js +0 -2
  112. package/functions/utilities/dotGet.js +47 -0
  113. package/functions/utilities/dotNotate.js +68 -0
  114. package/functions/utilities/dotSet.js +41 -0
  115. package/functions/utilities/isObject.js +9 -0
  116. package/functions/utilities/strAfter.js +13 -0
  117. package/functions/utilities/strBefore.js +13 -0
  118. package/functions/watchFull.js +0 -1
  119. package/functions/watchFull.test.js +1 -1
  120. package/functions/watchTest.js +1 -2
  121. package/functions/watchTest.test.js +1 -1
  122. package/gulp.config.js +153 -79
  123. package/gulpfile.base.js +5 -1
  124. package/jsdoc.base.js +1 -1
  125. package/package.json +13 -9
  126. package/vendor/array-union/index.js +31 -0
  127. package/vendor/easy-transform-stream/index.js +54 -0
  128. package/vendor/globby/gitignore.js +96 -0
  129. package/vendor/globby/index.js +191 -0
  130. package/vendor/globby/node_modules/slash/index.js +16 -0
  131. package/vendor/globby/stream-utils.js +58 -0
  132. package/vendor/globby/to-path.js +20 -0
  133. package/vendor/gulp-imagemin/index.js +128 -0
  134. package/vendor/gulp-imagemin/node_modules/chalk/source/index.js +265 -0
  135. package/vendor/gulp-imagemin/node_modules/chalk/source/utilities.js +36 -0
  136. package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/ansi-styles/index.js +217 -0
  137. package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/supports-color/index.js +154 -0
  138. package/vendor/gulp-plugin-extras/index.js +42 -0
  139. package/vendor/gulp-plugin-extras/node_modules/chalk/source/index.js +265 -0
  140. package/vendor/gulp-plugin-extras/node_modules/chalk/source/utilities.js +36 -0
  141. package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/ansi-styles/index.js +217 -0
  142. package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/supports-color/index.js +154 -0
  143. package/vendor/gulp-plugin-extras/plugin-error.js +145 -0
  144. package/vendor/ignore/index.js +468 -0
  145. package/vendor/imagemin/index.js +90 -0
  146. package/vendor/imagemin-gifsicle/index.js +33 -0
  147. package/vendor/imagemin-mozjpeg/index.js +100 -0
  148. package/vendor/imagemin-mozjpeg/node_modules/execa/index.js +260 -0
  149. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/command.js +47 -0
  150. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/error.js +102 -0
  151. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/kill.js +123 -0
  152. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/promise.js +47 -0
  153. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stdio.js +50 -0
  154. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stream.js +124 -0
  155. package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/core.js +238 -0
  156. package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/main.js +89 -0
  157. package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/realtime.js +24 -0
  158. package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/signals.js +44 -0
  159. package/vendor/imagemin-mozjpeg/node_modules/is-stream/index.js +25 -0
  160. package/vendor/imagemin-mozjpeg/node_modules/mimic-fn/index.js +70 -0
  161. package/vendor/imagemin-mozjpeg/node_modules/npm-run-path/index.js +52 -0
  162. package/vendor/imagemin-mozjpeg/node_modules/onetime/index.js +43 -0
  163. package/vendor/imagemin-mozjpeg/node_modules/path-key/index.js +20 -0
  164. package/vendor/imagemin-mozjpeg/node_modules/strip-final-newline/index.js +17 -0
  165. package/vendor/imagemin-optipng/index.js +44 -0
  166. package/vendor/imagemin-svgo/index.js +27 -0
  167. package/vendor/is-jpg/index.js +12 -0
  168. package/vendor/junk/index.js +49 -0
  169. package/vendor/mozjpeg/index.js +9 -0
  170. package/vendor/mozjpeg/lib/index.js +18 -0
  171. package/vendor/mozjpeg/package.json +49 -0
  172. package/vendor/mozjpeg/vendor/cjpeg +0 -0
  173. package/vendor/mozjpeg/vendor/source/mozjpeg.tar.gz +0 -0
  174. package/vendor/p-pipe/index.js +22 -0
  175. package/vendor/plur/index.js +32 -0
  176. package/vendor/pretty-bytes/index.js +71 -0
  177. package/vendor/slash/index.js +12 -0
  178. package/dist/test-helpers/circularObject.js +0 -50
  179. package/dist/test-helpers/countMatches.js +0 -12
  180. package/dist/test-helpers/deepReferenceObject.js +0 -20
  181. package/dist/test-helpers/domItem.js +0 -33
  182. package/dist/test-helpers/jsonDom.js +0 -20
  183. package/dist/test-helpers/linkedList.js +0 -23
  184. package/dist/test-helpers/logObject.js +0 -21
  185. package/dist/test-helpers/multiReferenceObject.js +0 -20
  186. package/dist/test-helpers/nodeTree.js +0 -28
  187. package/functions/test-helpers/circularObject.js +0 -28
  188. package/functions/test-helpers/circularObject.test.js +0 -14
  189. package/functions/test-helpers/countMatches.js +0 -11
  190. package/functions/test-helpers/countMatches.test.js +0 -9
  191. package/functions/test-helpers/deepReferenceObject.js +0 -25
  192. package/functions/test-helpers/deepReferenceObject.test.js +0 -7
  193. package/functions/test-helpers/domItem.js +0 -31
  194. package/functions/test-helpers/domItem.test.js +0 -12
  195. package/functions/test-helpers/jsonDom.js +0 -16
  196. package/functions/test-helpers/jsonDom.test.js +0 -12
  197. package/functions/test-helpers/linkedList.js +0 -10
  198. package/functions/test-helpers/linkedList.test.js +0 -22
  199. package/functions/test-helpers/logObject.js +0 -18
  200. package/functions/test-helpers/logObject.test.js +0 -20
  201. package/functions/test-helpers/multiReferenceObject.js +0 -25
  202. package/functions/test-helpers/multiReferenceObject.test.js +0 -14
  203. package/functions/test-helpers/nodeTree.js +0 -11
  204. package/functions/test-helpers/nodeTree.test.js +0 -18
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- /**
4
- * Sample NodeTree for testing circular references and arrays.
5
- * @memberOf module:testHelpers
6
- * @type {Object.<string, string|Object|Array>}
7
- */
8
- const nodeTree = {
9
- name: 'one',
10
- parent: null,
11
- children: []
12
- };
13
- nodeTree.children[0] = {
14
- name: 'child one',
15
- parent: nodeTree,
16
- children: []
17
- };
18
- nodeTree.children[1] = {
19
- name: 'child two',
20
- parent: nodeTree,
21
- children: []
22
- };
23
- nodeTree.children[0].children[0] = {
24
- name: 'grandchild one',
25
- parent: nodeTree.children[0],
26
- children: []
27
- };
28
- module.exports = nodeTree;
@@ -1,28 +0,0 @@
1
- /**
2
- * Multilayered node tree-like structure with parent references
3
- * @memberOf module:testHelpers
4
- * @type {Object.<string, string|Object|Array>}
5
- */
6
- const circularObject = { name: 'root', parent: {}, body: {}, head: {}, children: [] }
7
- circularObject.children = [
8
- { name: 'body', parent: {}, children: [] },
9
- { name: 'head', parent: {}, children: [] }
10
- ]
11
- circularObject.body = circularObject.children[0]
12
- circularObject.head = circularObject.children[1]
13
- circularObject.body.parent = circularObject
14
- circularObject.head.parent = circularObject
15
- circularObject.body.children = [
16
- { name: 'body child one', parent: {}, children: [] },
17
- { name: 'body child two', parent: {}, children: [] }
18
- ]
19
- circularObject.body.children[0].parent = circularObject.body
20
- circularObject.body.children[1].parent = circularObject.body
21
- circularObject.head.children = [
22
- { name: 'head child one', parent: {}, children: [] },
23
- { name: 'head child two', parent: {}, children: [] }
24
- ]
25
- circularObject.head.children[0].parent = circularObject.head
26
- circularObject.head.children[1].parent = circularObject.head
27
-
28
- module.exports = circularObject
@@ -1,14 +0,0 @@
1
- import circularObject from './circularObject'
2
-
3
- describe('circularObject', () => {
4
- test('has sample circular object', () => {
5
- expect(circularObject.body.parent).toBe(circularObject)
6
- expect(circularObject.body.children[0].parent).toBe(circularObject.body)
7
- expect(circularObject.body.children[1].parent).toBe(circularObject.body)
8
- expect(circularObject.children[0]).toBe(circularObject.body)
9
- expect(circularObject.head.parent).toBe(circularObject)
10
- expect(circularObject.head.children[0].parent).toBe(circularObject.head)
11
- expect(circularObject.head.children[1].parent).toBe(circularObject.head)
12
- expect(circularObject.children[1]).toBe(circularObject.head)
13
- })
14
- })
@@ -1,11 +0,0 @@
1
- /**
2
- * Simple way to count string occurrences for testing.
3
- * @function
4
- * @memberOf module:testHelpers
5
- * @param {string} content
6
- * @param {string} search
7
- * @returns {number}
8
- */
9
- const countMatches = (content, search) => content.split(search).length - 1
10
-
11
- module.exports = countMatches
@@ -1,9 +0,0 @@
1
- const countMatches = require('./countMatches')
2
-
3
- describe('countMatches', () => {
4
- test('can get count of string occurrences', () => {
5
- const find = 'find me'
6
- const sampleString = `${find} in some string that could change the times ${find} will occur here, ${find} should be found three times`
7
- expect(countMatches(sampleString, find)).toBe(3)
8
- })
9
- })
@@ -1,25 +0,0 @@
1
- /**
2
- * Sample object with deep references.
3
- * @memberOf module:testHelpers
4
- * @type {Object.<string, string|number|Object>}
5
- */
6
- const deepReferenceObject = {
7
- object1: {
8
- name: 'someName',
9
- object2: {
10
- age: 12,
11
- array1: [
12
- 'someString',
13
- 'anotherString'
14
- ]
15
- },
16
- array2: [
17
- 89,
18
- 32
19
- ]
20
- },
21
- title: 'Some Title',
22
- item: 45
23
- }
24
-
25
- module.exports = deepReferenceObject
@@ -1,7 +0,0 @@
1
- const deepReferenceObject = require('./deepReferenceObject')
2
-
3
- describe('deepReferenceObject', () => {
4
- test('has sample deep reference object', () => {
5
- expect(deepReferenceObject).toHaveProperty('object1.object2.array1')
6
- })
7
- })
@@ -1,31 +0,0 @@
1
- /**
2
- * Sample of domItem child with nested child and optional details
3
- * @memberOf module:testHelpers
4
- * @type {Object.<string, string|number|Array|Object>}
5
- */
6
- const domItem = [
7
- {
8
- attributes: { className: 'row', style: {} },
9
- axis: 'y',
10
- children: [
11
- {
12
- attributes: { style: {} },
13
- axis: 'x',
14
- children: [],
15
- element: {},
16
- eventListeners: {},
17
- hasShip: false,
18
- isHit: false,
19
- parentItem: {},
20
- point: {},
21
- tagName: 'div'
22
- }
23
- ],
24
- element: null,
25
- eventListeners: {},
26
- parentItem: {},
27
- tagName: 'div'
28
- }
29
- ]
30
-
31
- module.exports = domItem
@@ -1,12 +0,0 @@
1
- const domItem = require('./domItem')
2
-
3
- describe('domItem', () => {
4
- test('has sample domItem object', () => {
5
- expect(domItem[0]).toHaveProperty('attributes')
6
- expect(domItem[0]).toHaveProperty('children')
7
- expect(domItem[0]).toHaveProperty('element')
8
- expect(domItem[0]).toHaveProperty('eventListeners')
9
- expect(domItem[0]).toHaveProperty('parentItem')
10
- expect(domItem[0]).toHaveProperty('tagName')
11
- })
12
- })
@@ -1,16 +0,0 @@
1
- /**
2
- * Sample of jsonDom object containing empty nested array and objects
3
- * @memberOf module:testHelpers
4
- * @type {Object.<string, string|number|Array|Object>}
5
- */
6
- const jsonDom = {
7
- tagName: 'div',
8
- attributes: { style: {}, className: 'column' },
9
- element: null,
10
- eventListeners: {},
11
- parentItem: {},
12
- children: [],
13
- axis: 'x'
14
- }
15
-
16
- module.exports = jsonDom
@@ -1,12 +0,0 @@
1
- const jsonDom = require('./jsonDom')
2
-
3
- describe('jsonDom', () => {
4
- test('has sample jsonDom object', () => {
5
- expect(jsonDom).toHaveProperty('attributes')
6
- expect(jsonDom).toHaveProperty('children')
7
- expect(jsonDom).toHaveProperty('element')
8
- expect(jsonDom).toHaveProperty('eventListeners')
9
- expect(jsonDom).toHaveProperty('parentItem')
10
- expect(jsonDom).toHaveProperty('tagName')
11
- })
12
- })
@@ -1,10 +0,0 @@
1
- /**
2
- * Sample LinkedList for testing circular references.
3
- * @memberOf module:testHelpers
4
- * @type {Object.<string, string|Object>}
5
- */
6
- const linkedList = { name: 'one', prev: null, next: null }
7
- linkedList.next = { name: 'two', prev: linkedList, next: null }
8
- linkedList.next.next = { name: 'three', prev: linkedList.next, next: null }
9
-
10
- module.exports = linkedList
@@ -1,22 +0,0 @@
1
- const linkedList = require('./linkedList')
2
-
3
- describe('linkedList', () => {
4
- test('has sample linkedList object', () => {
5
- expect(linkedList.name).toBe('one')
6
- expect(linkedList).toHaveProperty('prev')
7
- expect(linkedList.prev).toBeNull()
8
-
9
- expect(linkedList).toHaveProperty('next')
10
- expect(linkedList.next.name).toBe('two')
11
- expect(linkedList).toHaveProperty('next.prev')
12
- expect(linkedList.next.prev).toBe(linkedList)
13
-
14
- expect(linkedList).toHaveProperty('next.next')
15
- expect(linkedList.next.next.name).toBe('three')
16
- expect(linkedList).toHaveProperty('next.prev')
17
- expect(linkedList.next.next.prev).toBe(linkedList.next)
18
-
19
- expect(linkedList).toHaveProperty('next.next.next')
20
- expect(linkedList.next.next.next).toBeNull()
21
- })
22
- })
@@ -1,18 +0,0 @@
1
- /**
2
- * Log out an object in a nicely formatted way.
3
- * @function
4
- * @memberOf module:testHelpers
5
- * @param {Object} object
6
- * @param {string} [label=logging]
7
- * @param {string} [outputType=log]
8
- * @returns {string|undefined}
9
- */
10
- const logObject = (object, label = 'logging', outputType = 'log') => {
11
- const logger = outputType === 'string' ? (label, object) => `'${label}' | ` + JSON.stringify(object) : console[outputType]
12
- if (typeof require === 'undefined' || outputType === 'string') {
13
- return logger(label, object)
14
- }
15
- return logger(label, require('util').inspect(object, false, null, true))
16
- }
17
-
18
- module.exports = logObject
@@ -1,20 +0,0 @@
1
- const logObject = require('./logObject')
2
- const util = require('util')
3
-
4
- describe('logObject', () => {
5
- test('can nicely output objects', () => {
6
- const logSpy = jest.spyOn(console, 'log').mockImplementation(jest.fn())
7
- const inspectSpy = jest.spyOn(util, 'inspect')
8
- const someObject = { one: 1, two: 2, three: 3 }
9
- logObject(someObject, 'someObject')
10
- expect(inspectSpy).toHaveBeenCalledWith(someObject, false, null, true)
11
- expect(logSpy).toHaveBeenCalledWith('someObject', util.inspect(someObject, false, null, true))
12
- })
13
-
14
- test('output to string when that argument is provided', () => {
15
- const someObject = { one: 1, two: 2, three: 3 }
16
- const label = 'someObject'
17
- const result = logObject(someObject, label, 'string')
18
- expect(result).toEqual(`'${label}' | ` + JSON.stringify(someObject))
19
- })
20
- })
@@ -1,25 +0,0 @@
1
- /**
2
- * Sample of object containing multiple references.
3
- * @memberOf module:testHelpers
4
- * @type {Object.<string, string|number|Object>}
5
- */
6
- const multiReferenceObject = {
7
- object1: {
8
- name: 'someName'
9
- },
10
- object2: {
11
- age: 12
12
- },
13
- array1: [
14
- 'someString',
15
- 'anotherString'
16
- ],
17
- array2: [
18
- 89,
19
- 32
20
- ],
21
- title: 'Some Title',
22
- item: 45
23
- }
24
-
25
- module.exports = multiReferenceObject
@@ -1,14 +0,0 @@
1
- const multiReferenceObject = require('./multiReferenceObject')
2
-
3
- describe('multiReferenceObject', () => {
4
- test('has sample multiReferenceObject object', () => {
5
- expect(multiReferenceObject).toHaveProperty('object1.name')
6
- expect(multiReferenceObject).toHaveProperty('object2.age')
7
- expect(multiReferenceObject).toHaveProperty('array1.0')
8
- expect(multiReferenceObject).toHaveProperty('array1.1')
9
- expect(multiReferenceObject).toHaveProperty('array2.0')
10
- expect(multiReferenceObject).toHaveProperty('array2.1')
11
- expect(multiReferenceObject).toHaveProperty('title')
12
- expect(multiReferenceObject).toHaveProperty('item')
13
- })
14
- })
@@ -1,11 +0,0 @@
1
- /**
2
- * Sample NodeTree for testing circular references and arrays.
3
- * @memberOf module:testHelpers
4
- * @type {Object.<string, string|Object|Array>}
5
- */
6
- const nodeTree = { name: 'one', parent: null, children: [] }
7
- nodeTree.children[0] = { name: 'child one', parent: nodeTree, children: [] }
8
- nodeTree.children[1] = { name: 'child two', parent: nodeTree, children: [] }
9
- nodeTree.children[0].children[0] = { name: 'grandchild one', parent: nodeTree.children[0], children: [] }
10
-
11
- module.exports = nodeTree
@@ -1,18 +0,0 @@
1
- import nodeTree from './nodeTree'
2
-
3
- describe('nodeTree', () => {
4
- test('has sample nodeTree object', () => {
5
- expect(nodeTree.name).toBe('one')
6
- expect(nodeTree.parent).toBeNull()
7
- expect(nodeTree.children.length).toBe(2)
8
- expect(nodeTree.children[0].name).toBe('child one')
9
- expect(nodeTree.children[0].parent).toBe(nodeTree)
10
- expect(nodeTree.children[0].children.length).toBe(1)
11
- expect(nodeTree.children[0].children[0].name).toBe('grandchild one')
12
- expect(nodeTree.children[0].children[0].parent).toBe(nodeTree.children[0])
13
- expect(nodeTree.children[0].children[0].children.length).toBe(0)
14
- expect(nodeTree.children[1].name).toBe('child two')
15
- expect(nodeTree.children[1].parent).toBe(nodeTree)
16
- expect(nodeTree.children[1].children.length).toBe(0)
17
- })
18
- })