Skip to content
Arne Westphal edited this page Nov 13, 2018 · 2 revisions

Tests

The tests contain a combination of unit and integration tests. Mainly the package API is tested. For testing mocha is used as defined in the package.json. To create test coverage in addition to the basic test results nyc is used.

Run Tests

There are two defined test scripts. npm test is meant to run tests with logging to console and coverage with file output. The coverage report will be located under coverage/.

The script npm run testXUnit is meant for Continuous Integration as it creates additional XUnit output which can be used to publish test results. These are stored in test-report.xml.

Converter Tests

The converter tests basically try to convert specific Markdown using the converters and check whether the results equal stored results. Therefore the folder testAssets exists. It is used to create temporary files while testing and also contains input files containing Markdown and output files containing the expected Html results.

When changing the conversion process these tests and files should always be updated, so the tests generate correct results.

ExtensionManager and FileExtractor

These tests try to cover all functions exported from the given classes. Temporary files are stored in testAssets/export/ like before.

Helpers

Helpers are functions either used as extended assert methods (AssertExtensions) or they change the test results to get comparable outputs. For example the PDFConverter creates absolute paths based on the location of markdown-elearnjs on the running system. Those cannot be compared to general results. Therefore the PostProcessing offers a method to convert these absolute paths to specific relative paths, so these can be compared and tested.

Clone this wiki locally