openhab / openhab-js

openHAB JavaScript Library for JavaScript Scripting Automation
https://www.openhab.org/addons/automation/jsscripting/
Eclipse Public License 2.0
38 stars 31 forks source link

[tests] Add unit tests to existing codebase #181

Closed sfriedle closed 1 year ago

sfriedle commented 1 year ago

Relates to #166

Description

This PR adds unit tests to the existing codebase. Until now there are only two unit tests, written with Mocha. The newly added tests use Jest as testing framework. To distinguish between the Mocha and Jest tests, we use this filename pattern:

The tests can be run with this commands:

sfriedle commented 1 year ago

@florian-h05 Shall we merge and close this pull request? The contained tests cover nearly all JavaScript files in the root directory. I can open new pull requests when I continue to write tests for the remaining files in subdirectories, like items, things, etc.

florian-h05 commented 1 year ago

I‘ll have a final look later, but I am very happy with merging this first PR!