pushrax / node-rcon

A generic RCON protocol client for node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unit testing

Syntro42 opened this issue · comments

Hi! I would like to use this package in a discord bot I’m creating. Would there be any way to include unit tests with this package? I want to mimic responses I would get back from a Minecraft server for testing purposes. Thanks!

A couple options:

  • call emit on the Rcon object to emit a response event. The only event argument is the data as a string.
  • extract your response callback into a separate function and simply call it

This library doesn’t have any knowledge of what’s actually in an Rcon request or response, it just treats it as an opaque blob of data. So you’ll need to come up with the format of a valid response yourself.

Thanks!