I started looking at using the test framework in the FDK and followed the documentation I found on the forum but when I run fdk test I get the following error in the console.
(node:9284) UnhandledPromiseRejectionWarning: TypeError: this.invoke is not a function
at Object. (C:\XXXXXXXXXXXX\test\onTicketUpdate.test.js:4:6)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at C:\Users\XXXXX\AppData\Roaming\npm\node_modules\fdk\node_modules\mocha\lib\mocha.js:250:27
at Array.forEach ()
at Mocha.loadFiles (C:\Users\XXXXX\AppData\Roaming\npm\node_modules\fdk\node_modules\mocha\lib\mocha.js:247:14)
at Mocha.run (C:\Users\XXXXXX\AppData\Roaming\npm\node_modules\fdk\node_modules\mocha\lib\mocha.js:576:10)
at Object.run (C:\Users\XXXXX\AppData\Roaming\npm\node_modules\fdk\lib\cli\test.js:167:8)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async runCLI (C:\Users\XXXXX\AppData\Roaming\npm\node_modules\fdk\index.js:261:5)
(node:9284) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:9284) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
The test script in onTicketUpdate.test.js is:
const ticketUpdateArg = require(’./test_data/onTicketUpdate.json’)
this.invoke(‘onTicketUpdate’, ticketUpdateArg);