ku4es-testing

kodmunki Utilities for ECMAScript Testing

Usage no npm install needed!

<script type="module">
  import ku4esTesting from 'https://cdn.skypack.dev/ku4es-testing';
</script>

README

Classes

Performance
Performance

Functions

startServer()

Starts a mock server for Unit Tests that cover code sections that include calls to a server. This must be called before you can successfully use sendResponse.

stopServer()

Stops a mock server started with startServer

sendResponse(response, [index])*

Performance

Kind: global class

new Performance([nowable])

Param Type Default Description
[nowable] Performance | DateConstructor DateConstructor Any object having method now that returns a time of type number.

new Performance(func, [iterations])

Param Type Default Description
func function A function whose body defines the performance test case.
[iterations] number 10000 The number of times to run func.

Performance

Kind: global class

new Performance([nowable])

Param Type Default Description
[nowable] Performance | DateConstructor DateConstructor Any object having method now that returns a time of type number.

new Performance(func, [iterations])

Param Type Default Description
func function A function whose body defines the performance test case.
[iterations] number 10000 The number of times to run func.

startServer()

Starts a mock server for Unit Tests that cover code sections that include calls to a server. This must be called before you can successfully use sendResponse.

Kind: global function

stopServer()

Stops a mock server started with startServer

Kind: global function

sendResponse(response, [index]) ⇒ *

Kind: global function

Param Type Default Description
response Object A response object
response.status number An HTTP status code.
response.response Object A mock response payload.
[index] number 0 The index of the response that you want to send. This is useful for those instances where your codebase makes multiple service calls and you need to send responses back to some or all of them.