benwebber / tiddlywiki-dnd

Manage D&D campaigns with TiddlyWiki
https://benwebber.github.io/tiddlywiki-dnd/
MIT License
35 stars 8 forks source link

Add TiddlyWiki integration tests #7

Open benwebber opened 5 years ago

benwebber commented 5 years ago

The dnd module unit tests are alright, but they're a little cumbersome and don't test the actual macro interface.

It'd be better to test the actual wikitext, using TiddlyWiki itself to render the macro. We'd need to instantiate TiddlyWiki in the test suite, then call Wiki.renderTiddler():

https://github.com/Jermolene/TiddlyWiki5/blob/810033bd71abfad14c7d92f340ce26c33eab4ce8/editions/test/tiddlers/tests/test-wikitext.js

benwebber commented 5 years ago

In order to measure integration test coverage, it may be necessary to run Jest inside TiddlyWiki instead, similar to how the upstream test harness runs Jasmine. That way Jest can instrument virtual modules within the TiddlyWiki module system (e.g., $:/plugins/benwebber/dnd/modules/macros/dnd.xp.js).