Methods
-
camouflageMock( call, callback )
-
Description
- Get the path of the determined handler from the call
- Find a mock file for the handler
- If mock file exists, apply handler compilation to generate actual values from helpers
- Execute callback with the response and delay
- Remove delay key if present before sending the response
- If mock file is not found, log error and send the same error to client
Parameters
Name Type Description call
any call object recieved with every unary call
callback
any callback to be executed once server is ready to return response
Details
-
camouflageMockServerStream( call, callback )
-
Description
- Get the path of the determined handler from the call
- Find a mock file for the handler
- If mock file exists, apply handler compilation to generate actual values from helpers
- Split the contents of file with ==== to get responses each stream
- Run a forEach and execute call.write() with the response and delay
- On last index of streamArray, execute call.end()
- Remove delay key if present before sending the response
- If mock file is not found, log error and send the same error to client
Parameters
Name Type Description call
any call object recieved with every unary call
callback
any callback to be executed once server is ready to return response
Details
-
camouflageMockClientStream( call, callback )
-
Description
- Get the path of the determined handler from the call
- Find a mock file for the handler
- If mock file exists, apply handler compilation to generate actual values from helpers
- No action required on recieving client's streams
- Once client calls end, respond with the compiled contents of the mockfile and delay
- Remove delay key if present before sending the response
- If mock file is not found, log error and send the same error to client
Parameters
Name Type Description call
any call object recieved with every unary call
callback
any callback to be executed once server is ready to return response
Details
-
camouflageMockBidiStream( call, callback )
-
Description
- Get the path of the determined handler from the call
- Find a mock file for the handler
- If mock file exists, apply handler compilation to generate actual values from helpers
- Follow a ping pong model, i.e. for every client's stream, respond with a server stream.
- On client stream, respond with filecontent.data
- Once client calls end, respond with filecontent.end
- Remove delay key if present before sending the response
- If mock file is not found, log error and send the same error to client
Parameters
Name Type Description call
any call object recieved with every unary call
callback
any callback to be executed once server is ready to return response
Details