The tests are living in tests directory, there two kind of test, unit and e2e.
We are using mocha and spectron`, the last one is for the tests of e2e. For every e2e test is using a configuration file. When the test run load the configuration file and we check expected result of the MagicMirror instance in Electron mode.
You can using the follow sentences to run testsuite
Unit test: npm run test:unit
E2e tests: npm run test:e2e
Unit + e2e: npm test
If you can run especific test you need execute mocha from your path where is installed, in my case inside of MagicMirror directorio. Example of running the specific unit test for calendar functions.
Functions into modules/default/calendar/calendar.js
✓ for 'rodrigo' should return 'Rodrigo'
✓ for '123m' should return '123m'
✓ for 'magic mirror' should return 'Magic mirror'
✓ for ',a' should return ',a'
✓ for 'ñandú' should return 'Ñandú'
✓ for ' String with whitespace at the beginning that needs trimming' should return 'String with whit…'
✓ for 'long string that needs shortening' should return 'long string that…'
✓ for 'short string' should return 'short string'
✓ for 'long string with no maxLength defined' should return 'long string with no maxLength defined'
✓ should return an empty string if shorten is called with a non-string
✓ should not shorten the string if shorten is called with a non-number maxLength
✓ should wrap the string instead of shorten it if shorten is called with wrapEvents = true (with maxLength defined as 20)
✓ should wrap the string instead of shorten it if shorten is called with wrapEvents = true (without maxLength defined, default 25)
13 passing (29ms)
@broberg : the requirement is not like that. The original idea is module internal timer with 1 second interval for example, can be replaced with event from the clock. The module no longer required to implement the timer itself.