1.0.13 • Published 3 years ago
test_waters v1.0.13
test_waters
Instructions:
npm install test_waters
const test_waters = require('test_waters')
If utilizing in html...:
<script src="./node_modules/test_waters/index.js"></script>
<script>
$(()=> {
const output = test_waters.method(parameter)
})
</script>
Functions
testAllTypes(name, export) ⇒ array
Kind: global function
Date: 2022-03-06
Author: zen-out
Param | Type | Description |
---|---|---|
name | string | |
export | function | function to pass in random inputs |
Example
export function justPrint(input) {
return "waters" + input;
}
let getAll = test_waters.testAllTypes("just print", justPrint)
console.log("🚀 ~ file: playground.js ~ line 7 ~ getAll", getAll)
testFunction(name, func, array) ⇒ array
Kind: global function
Date: 2022-03-16
Author: zen-out
Param | Type |
---|---|
name | string |
func | function |
array | array |
Example
let inputs = [
{ id: 1, name: "lesley" }, { id: 2, name: "ryan" }
]
export function addToDatabase(object) {
object["added"] = "done"
return object;
}
let result = test_waters.testFunction("add to database", addToDatabase, inputs)
console.log("🚀 ~ file: playground.js ~ line 34 ~ result", result)
testAsyncFunction(name, func, array) ⇒ array
testAsyncFunction(name, func, array of objects for input testing)
Kind: global function
Date: 2022-03-16
Author: zen-out
Param | Type |
---|---|
name | string |
func | function |
array | array |
Example
async export function resolveAfter2Seconds(object) {
let getPromise = await new Promise(resolve => {
setTimeout(() => {
resolve(object);
}, 2000);
});
return getPromise
}
async export function getTest() {
let results = await test_waters.testAsyncFunction("async", resolveAfter2Seconds, inputs)
console.log(results)
}
getTest()