Closed mwittig closed 8 years ago
I think we reach a degree of complexity were we need tests to ensure the stability of our code. I already thought about an approach for tests like this, which takes also in account that you like to split the plugin by devices . So I will try to add some basic tests.
https://github.com/philip1986/pimatic-led-light/pull/25/files#diff-fc25f60a59d04b30ef5515738aff8bc6R55
this line is also broken @power
is either 'on' or 'off', so the condition is always true.
Agree on testing :) Note, however, the power attribute should be true/false to get properly written to the database as far as I know. The dummy and blinkstick device implementations also use true/false btw.
Yeh we need to refactor this on/off implementation, its also quite confusing I just realized it during writing the tests.
So this PR is OK.
@mwittig checkout https://github.com/philip1986/pimatic-led-light/pull/26. This is what I have so far in terms of testing. please let me know what you thing about this approach.
Some tests are skipped because of broken code. This the includes also a test for setColor on milight, which should be fixed by this PR.
Hi @philip1986 I had a frist look at your test effort which I really like. what do I need to checkout to run the tests? Can I simply chckou the "feature/add_tests" branch?
@mwittig ok than I will go on whit this tests. Yes just checkout the branch and run npm install.
@philip1986 Added suggested fix for issue #19
See commit log for details