test-filesystem 1.0.0

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 (66) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +163 -0
  3. package/browser/test-fs.js +2856 -0
  4. package/browser/test-fs.min.js +1 -0
  5. package/dist/cjs/functions/circularObject.js +54 -0
  6. package/dist/cjs/functions/circularObject.min.js +1 -0
  7. package/dist/cjs/functions/countMatches.js +17 -0
  8. package/dist/cjs/functions/countMatches.min.js +1 -0
  9. package/dist/cjs/functions/deepReferenceObject.js +24 -0
  10. package/dist/cjs/functions/deepReferenceObject.min.js +1 -0
  11. package/dist/cjs/functions/domItem.js +37 -0
  12. package/dist/cjs/functions/domItem.min.js +1 -0
  13. package/dist/cjs/functions/jsonDom.js +24 -0
  14. package/dist/cjs/functions/jsonDom.min.js +1 -0
  15. package/dist/cjs/functions/linkedList.js +27 -0
  16. package/dist/cjs/functions/linkedList.min.js +1 -0
  17. package/dist/cjs/functions/logObject.js +24 -0
  18. package/dist/cjs/functions/logObject.min.js +1 -0
  19. package/dist/cjs/functions/multiReferenceObject.js +24 -0
  20. package/dist/cjs/functions/multiReferenceObject.min.js +1 -0
  21. package/dist/cjs/functions/nodeTree.js +32 -0
  22. package/dist/cjs/functions/nodeTree.min.js +1 -0
  23. package/dist/cjs/functions/removeDirectory.js +19 -0
  24. package/dist/cjs/functions/removeDirectory.min.js +1 -0
  25. package/dist/cjs/functions/setUp.js +87 -0
  26. package/dist/cjs/functions/setUp.min.js +1 -0
  27. package/dist/cjs/main.js +58 -0
  28. package/dist/cjs/main.min.js +1 -0
  29. package/dist/mjs/functions/circularObject.d.ts +14 -0
  30. package/dist/mjs/functions/circularObject.min.mjs +1 -0
  31. package/dist/mjs/functions/circularObject.mjs +33 -0
  32. package/dist/mjs/functions/countMatches.d.ts +10 -0
  33. package/dist/mjs/functions/countMatches.min.mjs +1 -0
  34. package/dist/mjs/functions/countMatches.mjs +10 -0
  35. package/dist/mjs/functions/deepReferenceObject.d.ts +18 -0
  36. package/dist/mjs/functions/deepReferenceObject.min.mjs +1 -0
  37. package/dist/mjs/functions/deepReferenceObject.mjs +24 -0
  38. package/dist/mjs/functions/domItem.d.ts +24 -0
  39. package/dist/mjs/functions/domItem.min.mjs +1 -0
  40. package/dist/mjs/functions/domItem.mjs +30 -0
  41. package/dist/mjs/functions/jsonDom.d.ts +8 -0
  42. package/dist/mjs/functions/jsonDom.min.mjs +1 -0
  43. package/dist/mjs/functions/jsonDom.mjs +15 -0
  44. package/dist/mjs/functions/linkedList.d.ts +12 -0
  45. package/dist/mjs/functions/linkedList.min.mjs +1 -0
  46. package/dist/mjs/functions/linkedList.mjs +9 -0
  47. package/dist/mjs/functions/logObject.d.ts +11 -0
  48. package/dist/mjs/functions/logObject.min.mjs +1 -0
  49. package/dist/mjs/functions/logObject.mjs +17 -0
  50. package/dist/mjs/functions/multiReferenceObject.d.ts +18 -0
  51. package/dist/mjs/functions/multiReferenceObject.min.mjs +1 -0
  52. package/dist/mjs/functions/multiReferenceObject.mjs +24 -0
  53. package/dist/mjs/functions/nodeTree.d.ts +12 -0
  54. package/dist/mjs/functions/nodeTree.min.mjs +1 -0
  55. package/dist/mjs/functions/nodeTree.mjs +10 -0
  56. package/dist/mjs/functions/removeDirectory.d.ts +9 -0
  57. package/dist/mjs/functions/removeDirectory.min.mjs +1 -0
  58. package/dist/mjs/functions/removeDirectory.mjs +12 -0
  59. package/dist/mjs/functions/setUp.d.ts +30 -0
  60. package/dist/mjs/functions/setUp.min.mjs +1 -0
  61. package/dist/mjs/functions/setUp.mjs +56 -0
  62. package/dist/mjs/main.d.ts +93 -0
  63. package/dist/mjs/main.min.mjs +1 -0
  64. package/dist/mjs/main.mjs +50 -0
  65. package/gulpfile.js +221 -0
  66. package/package.json +58 -0
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Multilayered node tree-like structure with parent references
3
+ * @memberOf module:test-fs
4
+ * @type {Object.<string, string|Object|Array>}
5
+ */
6
+ export const circularObject = {
7
+ name: 'root',
8
+ parent: null,
9
+ body: null,
10
+ head: null,
11
+ children: []
12
+ }
13
+ circularObject.children = [
14
+ { name: 'body', parent: null, children: [] },
15
+ { name: 'head', parent: null, children: [] }
16
+ ]
17
+ circularObject.body = circularObject.children[0]
18
+ circularObject.head = circularObject.children[1]
19
+ circularObject.body.parent = circularObject
20
+ circularObject.head.parent = circularObject
21
+ circularObject.body.children = [
22
+ { name: 'body child one', parent: null, children: [] },
23
+ { name: 'body child two', parent: null, children: [] }
24
+ ]
25
+ circularObject.body.children[0].parent = circularObject.body
26
+ circularObject.body.children[1].parent = circularObject.body
27
+ circularObject.head.children = [
28
+ { name: 'head child one', parent: null, children: [] },
29
+ { name: 'head child two', parent: null, children: [] }
30
+ ]
31
+ circularObject.head.children[0].parent = circularObject.head
32
+ circularObject.head.children[1].parent = circularObject.head
33
+ export default circularObject
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Simple way to count string occurrences for testing.
3
+ * @function
4
+ * @memberOf module:test-fs
5
+ * @param {string} content
6
+ * @param {string} search
7
+ * @returns {number}
8
+ */
9
+ export declare const countMatches: (content: string, search: string) => number;
10
+ export default countMatches;
@@ -0,0 +1 @@
1
+ export const countMatches=(t,e)=>t.split(e).length-1;export default countMatches;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Simple way to count string occurrences for testing.
3
+ * @function
4
+ * @memberOf module:test-fs
5
+ * @param {string} content
6
+ * @param {string} search
7
+ * @returns {number}
8
+ */
9
+ export const countMatches = (content, search) => content.split(search).length - 1
10
+ export default countMatches
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Sample object with deep references.
3
+ * @memberOf module:test-fs
4
+ * @type {Object.<string, string|number|Object>}
5
+ */
6
+ export declare const deepReferenceObject: {
7
+ object1: {
8
+ name: string;
9
+ object2: {
10
+ age: number;
11
+ array1: Array<string>;
12
+ };
13
+ array2: Array<number>;
14
+ };
15
+ title: string;
16
+ item: number;
17
+ };
18
+ export default deepReferenceObject;
@@ -0,0 +1 @@
1
+ export const deepReferenceObject={object1:{name:"someName",object2:{age:12,array1:["someString","anotherString"]},array2:[89,32]},title:"Some Title",item:45};export default deepReferenceObject;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Sample object with deep references.
3
+ * @memberOf module:test-fs
4
+ * @type {Object.<string, string|number|Object>}
5
+ */
6
+ export 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
+ export default deepReferenceObject
@@ -0,0 +1,24 @@
1
+ export type jsonDomItem = {
2
+ name?: string;
3
+ attributes?: {
4
+ className?: string;
5
+ style?: {};
6
+ };
7
+ axis?: 'x' | 'y' | 'z';
8
+ parent?: jsonDomItem | null;
9
+ children?: Array<jsonDomItem> | [];
10
+ element?: Node | {} | null;
11
+ eventListeners?: {};
12
+ hasShip?: boolean;
13
+ isHit?: boolean;
14
+ parentItem?: {} | null;
15
+ point?: {};
16
+ tagName?: string;
17
+ };
18
+ /**
19
+ * Sample of domItem child with nested child and optional details
20
+ * @memberOf module:test-fs
21
+ * @type {Object.<string, string|number|Array|Object>}
22
+ */
23
+ export declare const domItem: Array<jsonDomItem>;
24
+ export default domItem;
@@ -0,0 +1 @@
1
+ export const domItem=[{attributes:{className:"row",style:{}},axis:"y",children:[{attributes:{style:{}},axis:"x",children:[],element:{},eventListeners:{},hasShip:!1,isHit:!1,parentItem:{},point:{},tagName:"div"}],element:null,eventListeners:{},parentItem:{},tagName:"div"}];export default domItem;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Sample of domItem child with nested child and optional details
3
+ * @memberOf module:test-fs
4
+ * @type {Object.<string, string|number|Array|Object>}
5
+ */
6
+ export 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
+ export default domItem
@@ -0,0 +1,8 @@
1
+ import { jsonDomItem } from './domItem';
2
+ /**
3
+ * Sample of jsonDom object containing an empty nested array and objects
4
+ * @memberOf module:test-fs
5
+ * @type {Object.<string, string|number|Array|Object>}
6
+ */
7
+ export declare const jsonDom: jsonDomItem;
8
+ export default jsonDom;
@@ -0,0 +1 @@
1
+ export const jsonDom={tagName:"div",attributes:{style:{},className:"column"},element:null,eventListeners:{},parentItem:{},children:[],axis:"x"};export default jsonDom;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Sample of jsonDom object containing an empty nested array and objects
3
+ * @memberOf module:test-fs
4
+ * @type {Object.<string, string|number|Array|Object>}
5
+ */
6
+ export const jsonDom = {
7
+ tagName: 'div',
8
+ attributes: { style: {}, className: 'column' },
9
+ element: null,
10
+ eventListeners: {},
11
+ parentItem: {},
12
+ children: [],
13
+ axis: 'x'
14
+ }
15
+ export default jsonDom
@@ -0,0 +1,12 @@
1
+ export type linker = {
2
+ name: string;
3
+ prev: linker | null;
4
+ next: linker | null;
5
+ };
6
+ /**
7
+ * Sample LinkedList for testing circular references.
8
+ * @memberOf module:test-fs
9
+ * @type {Object.<string, string|Object>}
10
+ */
11
+ export declare const linkedList: linker;
12
+ export default linkedList;
@@ -0,0 +1 @@
1
+ export const linkedList={name:"one",prev:null,next:null};linkedList.next={name:"two",prev:linkedList,next:null},linkedList.next.next={name:"three",prev:linkedList.next,next:null};export default linkedList;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Sample LinkedList for testing circular references.
3
+ * @memberOf module:test-fs
4
+ * @type {Object.<string, string|Object>}
5
+ */
6
+ export 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
+ export default linkedList
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Log out an object in a nicely formatted way.
3
+ * @function
4
+ * @memberOf module:test-fs
5
+ * @param {Object} object
6
+ * @param {string} [label=logging]
7
+ * @param {string} [outputType=log]
8
+ * @returns {string|undefined}
9
+ */
10
+ export declare const logObject: (object: any, label?: string, outputType?: 'debug' | 'error' | 'log' | 'string' | 'warn') => string | void;
11
+ export default logObject;
@@ -0,0 +1 @@
1
+ export const logObject=(e,t="logging",n="log")=>{const o="string"===n?(e,t)=>`'${e}' | `+JSON.stringify(t):console[n];return"undefined"==typeof require||"string"===n?o(t,e):o(t,require("util").inspect(e,!1,null,!0))};export default logObject;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Log out an object in a nicely formatted way.
3
+ * @function
4
+ * @memberOf module:test-fs
5
+ * @param {Object} object
6
+ * @param {string} [label=logging]
7
+ * @param {string} [outputType=log]
8
+ * @returns {string|undefined}
9
+ */
10
+ export 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
+ export default logObject
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Sample of an object containing multiple references.
3
+ * @memberOf module:test-fs
4
+ * @type {Object.<string, string|number|Object>}
5
+ */
6
+ export declare const multiReferenceObject: {
7
+ object1: {
8
+ name: string;
9
+ };
10
+ object2: {
11
+ age: number;
12
+ };
13
+ array1: Array<string>;
14
+ array2: Array<number>;
15
+ title: string;
16
+ item: number;
17
+ };
18
+ export default multiReferenceObject;
@@ -0,0 +1 @@
1
+ export const multiReferenceObject={object1:{name:"someName"},object2:{age:12},array1:["someString","anotherString"],array2:[89,32],title:"Some Title",item:45};export default multiReferenceObject;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Sample of an object containing multiple references.
3
+ * @memberOf module:test-fs
4
+ * @type {Object.<string, string|number|Object>}
5
+ */
6
+ export 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
+ export default multiReferenceObject
@@ -0,0 +1,12 @@
1
+ export type treeLinker = {
2
+ name: string;
3
+ parent: treeLinker | null;
4
+ children: Array<treeLinker> | [];
5
+ };
6
+ /**
7
+ * Sample NodeTree for testing circular references and arrays.
8
+ * @memberOf module:test-fs
9
+ * @type {Object.<string, string|Object|Array>}
10
+ */
11
+ export declare const nodeTree: treeLinker;
12
+ export default nodeTree;
@@ -0,0 +1 @@
1
+ export const nodeTree={name:"one",parent:null,children:[]};nodeTree.children[0]={name:"child one",parent:nodeTree,children:[]},nodeTree.children[1]={name:"child two",parent:nodeTree,children:[]},nodeTree.children[0].children[0]={name:"grandchild one",parent:nodeTree.children[0],children:[]};export default nodeTree;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Sample NodeTree for testing circular references and arrays.
3
+ * @memberOf module:test-fs
4
+ * @type {Object.<string, string|Object|Array>}
5
+ */
6
+ export 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
+ export default nodeTree
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Return a promise to be completed once the specified directory is deleted.
3
+ * @function
4
+ * @memberOf module:test-fs
5
+ * @param {string} dirPath
6
+ * @returns {Promise<*>}
7
+ */
8
+ export declare const removeDirectory: (dirPath: string) => Promise<any>;
9
+ export default removeDirectory;
@@ -0,0 +1 @@
1
+ import{access,constants,rm}from"fs";export const removeDirectory=e=>new Promise(((r,o)=>access(e,constants.F_OK,(s=>s?r(e):rm(e,{recursive:!0},(s=>s?o(s):r(e)))))));export default removeDirectory;
@@ -0,0 +1,12 @@
1
+ import { access, constants, rm } from 'fs'
2
+ /**
3
+ * Return a promise to be completed once the specified directory is deleted.
4
+ * @function
5
+ * @memberOf module:test-fs
6
+ * @param {string} dirPath
7
+ * @returns {Promise<*>}
8
+ */
9
+ export const removeDirectory = (dirPath) => new Promise((resolve, reject) => access(dirPath, constants.F_OK, (removed) => removed
10
+ ? resolve(dirPath)
11
+ : rm(dirPath, { recursive: true }, (error) => error ? reject(error) : resolve(dirPath))))
12
+ export default removeDirectory
@@ -0,0 +1,30 @@
1
+ /**
2
+ * In the Jest.afterEach function call this one to clean up and remove the temp directory.
3
+ * @function
4
+ * @memberOf module:test-fs
5
+ * @returns {Promise<*>}
6
+ */
7
+ export declare const afterEach: () => Promise<any>;
8
+ /**
9
+ * Ensure that the del has completed, recursively attempt to delete and recreate
10
+ * @function
11
+ * @memberOf module:test-fs
12
+ * @param {boolean} [exists=true]
13
+ * @returns {Promise<*|void>}
14
+ */
15
+ export declare const createTempDir: (exists?: boolean) => Promise<any | void>;
16
+ /**
17
+ * In the Jest.beforeEach function call this one to set up the temp directory.
18
+ * @function
19
+ * @memberOf module:test-fs
20
+ * @returns {Promise<*|void>}
21
+ */
22
+ export declare const beforeEach: () => Promise<any | void>;
23
+ export declare const setDefaults: (dirPath?: string) => void;
24
+ export declare const setUp: {
25
+ afterEach: () => Promise<any>;
26
+ beforeEach: () => Promise<any | void>;
27
+ createTempDir: (exists?: boolean) => Promise<any | void>;
28
+ setDefaults: (dirPath?: string) => void;
29
+ };
30
+ export default setUp;
@@ -0,0 +1 @@
1
+ var __awaiter=this&&this.__awaiter||function(e,t,r,c){return new(r||(r=Promise))((function(o,i){function a(e){try{s(c.next(e))}catch(e){i(e)}}function n(e){try{s(c.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,n)}s((c=c.apply(e,t||[])).next())}))};import{existsSync,mkdirSync}from"fs";import removeDirectory from"./removeDirectory";let tempDir="test-temp/",srcPath=`${tempDir}src`;export const afterEach=()=>removeDirectory(tempDir);export const createTempDir=(e=!0)=>__awaiter(void 0,void 0,void 0,(function*(){return e?removeDirectory(tempDir).then((e=>createTempDir(existsSync(e)))).catch((e=>console.error("Error: ",e))):mkdirSync(srcPath,{recursive:!0})}));export const beforeEach=()=>createTempDir();export const setDefaults=(e=null)=>{e&&(tempDir=e,srcPath=`${tempDir}src`)};export const setUp={afterEach:afterEach,beforeEach:beforeEach,createTempDir:createTempDir,setDefaults:setDefaults};export default setUp;
@@ -0,0 +1,56 @@
1
+ import { existsSync, mkdirSync } from 'fs'
2
+ // Import the configurations and override some of them to direct to the temp directory.
3
+ import removeDirectory from './removeDirectory'
4
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5
+ function adopt (value) { return value instanceof P ? value : new P(function (resolve) { resolve(value) }) }
6
+ return new (P || (P = Promise))(function (resolve, reject) {
7
+ function fulfilled (value) { try { step(generator.next(value)) } catch (e) { reject(e) } }
8
+ function rejected (value) { try { step(generator.throw(value)) } catch (e) { reject(e) } }
9
+ function step (result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected) }
10
+ step((generator = generator.apply(thisArg, _arguments || [])).next())
11
+ })
12
+ }
13
+ let tempDir = 'test-temp/'
14
+ let srcPath = `${tempDir}src`
15
+ /**
16
+ * In the Jest.afterEach function call this one to clean up and remove the temp directory.
17
+ * @function
18
+ * @memberOf module:test-fs
19
+ * @returns {Promise<*>}
20
+ */
21
+ export const afterEach = () => removeDirectory(tempDir)
22
+ /**
23
+ * Ensure that the del has completed, recursively attempt to delete and recreate
24
+ * @function
25
+ * @memberOf module:test-fs
26
+ * @param {boolean} [exists=true]
27
+ * @returns {Promise<*|void>}
28
+ */
29
+ export const createTempDir = (exists = true) => __awaiter(void 0, void 0, void 0, function * () {
30
+ if (exists) {
31
+ return removeDirectory(tempDir)
32
+ .then(removedDir => createTempDir(existsSync(removedDir)))
33
+ .catch(error => console.error('Error: ', error))
34
+ }
35
+ return mkdirSync(srcPath, { recursive: true })
36
+ })
37
+ /**
38
+ * In the Jest.beforeEach function call this one to set up the temp directory.
39
+ * @function
40
+ * @memberOf module:test-fs
41
+ * @returns {Promise<*|void>}
42
+ */
43
+ export const beforeEach = () => createTempDir()
44
+ export const setDefaults = (dirPath = null) => {
45
+ if (dirPath) {
46
+ tempDir = dirPath
47
+ srcPath = `${tempDir}src`
48
+ }
49
+ }
50
+ export const setUp = {
51
+ afterEach,
52
+ beforeEach,
53
+ createTempDir,
54
+ setDefaults
55
+ }
56
+ export default setUp
@@ -0,0 +1,93 @@
1
+ /**
2
+ * An assortment of objects that can be used in tests and some functions to help debug and write tests.
3
+ * @file
4
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
5
+ * @version 1.0.0
6
+ * @module test-fs
7
+ */
8
+ export declare let testFs: {
9
+ circularObject: {
10
+ name: string;
11
+ parent: null;
12
+ body: import("./functions/domItem").jsonDomItem;
13
+ head: import("./functions/domItem").jsonDomItem;
14
+ children: [] | import("./functions/domItem").jsonDomItem[];
15
+ };
16
+ countMatches: (content: string, search: string) => number;
17
+ deepReferenceObject: {
18
+ object1: {
19
+ name: string;
20
+ object2: {
21
+ age: number;
22
+ array1: string[];
23
+ };
24
+ array2: number[];
25
+ };
26
+ title: string;
27
+ item: number;
28
+ };
29
+ domItem: import("./functions/domItem").jsonDomItem[];
30
+ jsonDom: import("./functions/domItem").jsonDomItem;
31
+ linkedList: import("./functions/linkedList").linker;
32
+ logObject: (object: any, label?: string, outputType?: "string" | "error" | "debug" | "log" | "warn") => string | void;
33
+ multiReferenceObject: {
34
+ object1: {
35
+ name: string;
36
+ };
37
+ object2: {
38
+ age: number;
39
+ };
40
+ array1: string[];
41
+ array2: number[];
42
+ title: string;
43
+ item: number;
44
+ };
45
+ nodeTree: import("./functions/nodeTree").treeLinker;
46
+ removeDirectory: (dirPath: string) => Promise<any>;
47
+ setUp: {
48
+ afterEach: () => Promise<any>;
49
+ beforeEach: () => Promise<any>;
50
+ createTempDir: (exists?: boolean) => Promise<any>;
51
+ setDefaults: (dirPath?: string) => void;
52
+ };
53
+ };
54
+ export default testFs;
55
+ export declare let testFsBrowser: {
56
+ circularObject: {
57
+ name: string;
58
+ parent: null;
59
+ body: import("./functions/domItem").jsonDomItem;
60
+ head: import("./functions/domItem").jsonDomItem;
61
+ children: [] | import("./functions/domItem").jsonDomItem[];
62
+ };
63
+ countMatches: (content: string, search: string) => number;
64
+ deepReferenceObject: {
65
+ object1: {
66
+ name: string;
67
+ object2: {
68
+ age: number;
69
+ array1: string[];
70
+ };
71
+ array2: number[];
72
+ };
73
+ title: string;
74
+ item: number;
75
+ };
76
+ domItem: import("./functions/domItem").jsonDomItem[];
77
+ jsonDom: import("./functions/domItem").jsonDomItem;
78
+ linkedList: import("./functions/linkedList").linker;
79
+ logObject: (object: any, label?: string, outputType?: "string" | "error" | "debug" | "log" | "warn") => string | void;
80
+ multiReferenceObject: {
81
+ object1: {
82
+ name: string;
83
+ };
84
+ object2: {
85
+ age: number;
86
+ };
87
+ array1: string[];
88
+ array2: number[];
89
+ title: string;
90
+ item: number;
91
+ };
92
+ nodeTree: import("./functions/nodeTree").treeLinker;
93
+ };
@@ -0,0 +1 @@
1
+ import circularObject from"./functions/circularObject";import countMatches from"./functions/countMatches";import deepReferenceObject from"./functions/deepReferenceObject";import domItem from"./functions/domItem";import jsonDom from"./functions/jsonDom";import linkedList from"./functions/linkedList";import logObject from"./functions/logObject";import multiReferenceObject from"./functions/multiReferenceObject";import nodeTree from"./functions/nodeTree";import removeDirectory from"./functions/removeDirectory";import setUp from"./functions/setUp";export let testFs={circularObject:circularObject,countMatches:countMatches,deepReferenceObject:deepReferenceObject,domItem:domItem,jsonDom:jsonDom,linkedList:linkedList,logObject:logObject,multiReferenceObject:multiReferenceObject,nodeTree:nodeTree,removeDirectory:removeDirectory,setUp:setUp};export default testFs;export let testFsBrowser={circularObject:circularObject,countMatches:countMatches,deepReferenceObject:deepReferenceObject,domItem:domItem,jsonDom:jsonDom,linkedList:linkedList,logObject:logObject,multiReferenceObject:multiReferenceObject,nodeTree:nodeTree};this?this.testFs=testFsBrowser:"undefined"!=typeof window&&(window.testFs=testFsBrowser);
@@ -0,0 +1,50 @@
1
+ /**
2
+ * An assortment of objects that can be used in tests and some functions to help debug and write tests.
3
+ * @file
4
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
5
+ * @version 1.0.0
6
+ * @module test-fs
7
+ */
8
+ import circularObject from './functions/circularObject'
9
+ import countMatches from './functions/countMatches'
10
+ import deepReferenceObject from './functions/deepReferenceObject'
11
+ import domItem from './functions/domItem'
12
+ import jsonDom from './functions/jsonDom'
13
+ import linkedList from './functions/linkedList'
14
+ import logObject from './functions/logObject'
15
+ import multiReferenceObject from './functions/multiReferenceObject'
16
+ import nodeTree from './functions/nodeTree'
17
+ import removeDirectory from './functions/removeDirectory'
18
+ import setUp from './functions/setUp'
19
+ export const testFs = {
20
+ circularObject,
21
+ countMatches,
22
+ deepReferenceObject,
23
+ domItem,
24
+ jsonDom,
25
+ linkedList,
26
+ logObject,
27
+ multiReferenceObject,
28
+ nodeTree,
29
+ removeDirectory,
30
+ setUp
31
+ }
32
+ export default testFs
33
+ export const testFsBrowser = {
34
+ circularObject,
35
+ countMatches,
36
+ deepReferenceObject,
37
+ domItem,
38
+ jsonDom,
39
+ linkedList,
40
+ logObject,
41
+ multiReferenceObject,
42
+ nodeTree
43
+ }
44
+ if (this) {
45
+ // @ts-ignore
46
+ this.testFs = testFsBrowser
47
+ } else if (typeof window !== 'undefined') {
48
+ // @ts-ignore
49
+ window.testFs = testFsBrowser
50
+ }