API Reference
class DeclaredAPI
method unmock
Purpose
Undoes API mockingAvailability
This functionality is available from papupata version 1.1.0 onwards.Usage
This function undoes the mocking done by the mock and mockOnce methods. The latter calls unmock automatically upon the first invocation, but if it did not happen then you might want to call it yourself to do cleanup. might want to use the method instead, as it automatically removes the mock implementation as soon as the invocation has been completed.
You can alternatively call the unmockAll method of the API declaration to undo all mocks on that declaration.
Parameters
There are no parameters.
Returns
nothingExamples
import { APIDeclaration } from 'papupata'
const api = new APIDeclaration()
const myAPI = api.declarePostAPI('/do-stuff/:param')
.response<string>()
myAPI.mock('test')
myAPI.unmock()