HAP-NodeJS
                                
                                
                                
                                    HAP-NodeJS copied to clipboard
                            
                            
                            
                        Improve test coverage
:recycle: Current situation
Currently, a lot of parts of the HAP-NodeJS library are lacking test cases and consequentially the test coverage of the project is pretty low. This reduces our ability to catch regressions when doing changes to the code base.
:bulb: Proposed solution
This PR tries to improve the situation adding several test cases.
:gear: Release Notes
- Added several test cases for all HAP-NodeJS components
 
:heavy_plus_sign: Additional Information
This PR contains also slight adjustments to the code itself where it made sense or where bugs were uncovered while wiring the tests. The PR also introduces several deprecation warnings.
Testing
Well, we added test cases for a bunch of components.
Reviewer Nudging
--
Pull Request Test Coverage Report for Build 3468588397
- 453 of 501 (90.42%) changed or added relevant lines in 17 files are covered.
 - 1 unchanged line in 1 file lost coverage.
 - Overall coverage increased (+13.3%) to 65.071%
 
| Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | 
|---|---|---|---|
| src/lib/util/time.ts | 1 | 2 | 50.0% | 
| src/lib/util/tlv.ts | 13 | 14 | 92.86% | 
| src/lib/Accessory.ts | 55 | 57 | 96.49% | 
| src/lib/util/promise-utils.ts | 7 | 9 | 77.78% | 
| src/lib/util/tlvError.ts | 2 | 5 | 40.0% | 
| src/lib/util/HAPHTTPError.ts | 2 | 6 | 33.33% | 
| src/lib/util/eventedhttp.ts | 25 | 30 | 83.33% | 
| src/lib/HAPServer.ts | 20 | 35 | 57.14% | 
| src/test-utils/HAPHTTPClient.ts | 151 | 166 | 90.96% | 
| <!-- | Total: | 453 | 501 | 
| Files with Coverage Reduction | New Missed Lines | % | 
|---|---|---|
| src/lib/util/eventedhttp.ts | 1 | 82.98% | 
| <!-- | Total: | 1 | 
| Totals | |
|---|---|
| Change from base Build 3418642106: | 13.3% | 
| Covered Lines: | 7402 | 
| Relevant Lines: | 10595 |