mock20

1.3.1 • Public • Published

Mock20

Build Status Coverage Status dependencies Status

A node.js module that mocks the Roll20 API environment.

For an exmple Roll20 project that uses Mock20, see Example Mock20 Testing.

Installation

  1. Get node and npm.

  2. Turn your scripts into a node module.

  3. Add mock20 as a dependency.

    npm install mock20

  4. Require mock20 and signal the end of your scripts.

    require('mock20');
     
    //your script here
    
    MOCK20endOfLastScript(); //triggers all of your on('ready') functions
    

Mocking

Mock20 mocks all of the functions listed in the Roll20 API wiki.

See the wiki for more information.

  • API:Objects
  • API:Events
  • API:Chat
    • WARNING: The current version of Mock20 does not parse rolls like '/r D20'
    • WARNING: The current version of Mock20 does not parse inlines like 'Rolls a [[D20]]'
  • API:Utility

Simulating

Mock20 can simulate circumstances you may want to test.

See the wiki for more information.

var player = createObj('player', {_displayname: 'test player'}, {MOCK20override: true});
var gm = createObj('player', {_displayname: 'test gm'}, {MOCK20override: true});
gm.MOCK20gm = true;

player.MOCK20chat('!gmOnlyCMD');
gm.MOCK20chat('!gmOnlyCMD');

Issues

If you have any issues with Mock20 please report them through github's issues.

Contributing

If you would like to contribute to the project, open up a fork and work away.

Readme

Keywords

Package Sidebar

Install

npm i mock20

Weekly Downloads

5

Version

1.3.1

License

ISC

Last publish

Collaborators

  • kyledavidady