TestHelper

TestHelper

Unit test utility class

Help to:

  • generate a valid Configuration instance into test/* folder
  • allow to send request to test web server front controller

Test Helper configuration

Constructor

new TestHelper()

Source:

Methods

checkIfModuleIsLoaded(pModuleName) → {Boolean}

Source:

To verify if a NodeJS module is loaded or not by its name

Parameters:
Name Type Description
pModuleName String

Module name

Returns:

TRUE is the module is loaded, else FALSE

Type
Boolean

(async) execAsync(pCmd)

Source:

To mock conditionnaly Process.execAsync()

Parameters:
Name Type Description
pCmd *

execSync(pCmd)

Source:

To mock conditionnaly Process.execSync()

Parameters:
Name Type Description
pCmd *

getDexcaliburEngine(pForce)

Source:
Parameters:
Name Type Default Description
pForce * false

getDexcaliburProject(pForce) → {DexcaliburProject}

Source:
Parameters:
Name Type Default Description
pForce false
Returns:
Type
DexcaliburProject

getInitializedDexcaliburProject(pForce) → {DexcaliburProject}

Source:
Parameters:
Name Type Default Description
pForce false
Returns:
Type
DexcaliburProject

newDexcaliburEngine()

Source:

newDexcaliburProject() → {DexcaliburProject}

Source:
Returns:
Type
DexcaliburProject

resetDexcaliburWorkspace(pPath)

Source:
Parameters:
Name Type Default Description
pPath * null

sendHTTPRequest(pMethod, pURL, pData, pContentType)

Source:
Parameters:
Name Type Default Description
pMethod String

The HTTP method : GET | POST | PUT | DELETE

pURL *
pData * null
pContentType * null

sendRequest_GET(pURL, pData)

Source:

To send an HTTP GET request to a given URL.

Parameters:
Name Type Description
pURL String
pData Object

sendRequest_POST_JSON(pURL, pData)

Source:

To send serialized data in JSON format through an HTTP POST request to a given URL.

Parameters:
Name Type Description
pURL String
pData Object

setWebServerInstance(pInstance)

Source:

To set the web server instance

Parameters:
Name Type Description
pInstance require('express').Application

Web server instance