node-poweredup
node-poweredup copied to clipboard
Unit tests draft
Attempt to create a test suite to check logic without physical devices.
- mock BLE device to send/receive messages
- for each lpf2 hub:
- check connection process
- check supported version control
- for each lpf2 hub device:
- check device attachment
Also fix _requestHubPropertyValue
so it will reject if _parseHubPropertyResponse
throws.
@aileo Hi, apologies for taking a while to get to this, I've taken some time off this project to work on a couple of other things - and work is busy at the moment. :)
I tried this PR, and it's awesome! I wanted to add unit tests but never gotten round to it, so it's awesome you did this!
To be honest, I'm perfectly happy merging this as is - it works great, tests pass, and it adds a lot to the project.
The only thing is that when I run npm run build:all
it complains about test/test.ts
existing outside of rootDir
. :)
Hi, apologies for taking a while to get to this, I've taken some time off this project to work on a couple of other things - and work is busy at the moment. :)
Very nice tchoo-tchoo videos :)
I tried this PR, and it's awesome! I wanted to add unit tests but never gotten round to it, so it's awesome you did this!
To be honest, I'm perfectly happy merging this as is - it works great, tests pass, and it adds a lot to the project.
The only thing is that when I run
npm run build:all
it complains abouttest/test.ts
existing outside ofrootDir
. :)
I'm happy if you're happy :D I tried to deal with the compiling error, but it ended not compiling at all so I am asking for support :) I think I should write tests for at least one device before merging so it shows what is expected if anyone wants to contribute... But I don't know myself where to start, maybe the simplest ones (current, voltage, hub button and hub led), what do you think ?
Very nice tchoo-tchoo videos :)
I decided to have some fun and actually write some code that uses this library for once. ;)
I think I should write tests for at least one device before merging so it shows what is expected if anyone wants to contribute... But I don't know myself where to start, maybe the simplest ones (current, voltage, hub button and hub led), what do you think ?
I think that's a great idea. Perhaps one output device and one input device as a demonstration of both? I think Hub Button and Hub LED would both be good candidates for this.
Hi, sorry for the delay, I finally got back on this lib.
I think that's a great idea. Perhaps one output device and one input device as a demonstration of both? I think Hub Button and Hub LED would both be good candidates for this.
I wrote tests for the HubLED Device but the Hub buttons are not devices so I will go for the remotecontrolbutton instead.