Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test coverage #973

Merged
merged 29 commits into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
184ca85
Add tlv test cases
Supereg Sep 21, 2022
f56a5c2
Add eventedhttp test cases
Supereg Sep 21, 2022
7951ebf
Allow negative values for totalSocketCount.
Supereg Sep 21, 2022
b8e906c
Fix cyclic imports! Add small HAPServer test
Supereg Sep 28, 2022
37892fb
Add basic HAPServer negative test cases
Supereg Oct 6, 2022
1387c7d
Add test case to verify we are sending out correct event trigger opti…
Supereg Oct 6, 2022
61bb9bf
/pair-setup and pair-verify test cases
Supereg Oct 10, 2022
8c2073d
Fixe open resource handles
Supereg Oct 11, 2022
88ddd42
Make pair-setup and pair-verify reusable!
Supereg Oct 11, 2022
ccfe4ee
Test that encryption keys work after pair-verify step
Supereg Oct 12, 2022
ca2bfd5
Move direct socket access into a layer of abstraction
Supereg Oct 13, 2022
3e9b226
Increase HAPServer test coverage
Supereg Oct 13, 2022
847404e
Add characteristic WRITE tests
Supereg Oct 14, 2022
9153601
Fix imports
Supereg Oct 17, 2022
66ee924
Finish HAPServer tests
Supereg Oct 17, 2022
407dcaf
Add RecordingManagement tests
Supereg Oct 20, 2022
96f1415
Do not use CiaoAdvertiser for now, as it creates open handles
Supereg Oct 31, 2022
e5f704c
Adding Accessory pairing tests
Supereg Nov 7, 2022
c8d041e
Fix spelling and improve typing of addService
Supereg Nov 7, 2022
87388d8
add tests for handleAccessories
Supereg Nov 7, 2022
495f719
Fix compilation error in the example
Supereg Nov 7, 2022
0728c30
Simple characteristic read test
Supereg Nov 7, 2022
bfb665d
Add coverage badge
Supereg Nov 8, 2022
afb9d5e
Adding characteristic write tests
Supereg Nov 9, 2022
274831f
More accessory test cases
Supereg Nov 10, 2022
9f671cd
Add controller tests, add bind option tests, add characteristic warni…
Supereg Nov 14, 2022
272c4d2
Todo cleanup and write response tests
Supereg Nov 14, 2022
36505b7
Iterate on write-response tests
Supereg Nov 14, 2022
f3e04cd
Add more detailed hapCrypto layerEncrypt and layerDecrypt tests
Supereg Nov 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<a href="https://www.npmjs.com/package/hap-nodejs/v/beta"><img title="npm version beta" src="https://badgen.net/npm/v/hap-nodejs/beta" ></a>
<a href="https://www.npmjs.com/package/hap-nodejs"><img title="npm downloads" src="https://badgen.net/npm/dt/hap-nodejs" ></a>
<a href="https://github.com/homebridge/HAP-NodeJS/actions/workflows/build.yml"><img title="Node Build" src="https://github.com/homebridge/HAP-NodeJS/actions/workflows/build.yml/badge.svg" ></a>
<a href='https://coveralls.io/github/homebridge/HAP-NodeJS'><img src='https://coveralls.io/repos/github/homebridge/HAP-NodeJS/badge.svg' alt='Coverage Status' /></a>

</span>

Expand Down
11 changes: 0 additions & 11 deletions jest.config.js

This file was deleted.

12 changes: 12 additions & 0 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"preset": "ts-jest",
"testEnvironment": "node",
"coverageReporters": ["lcov"],
"collectCoverageFrom": [
"src/**",
"!src/accessories/**",
"!src/lib/definitions/generate-definitions.ts",
"!src/lib/definitions/generator-configuration.ts",
"!src/test-utils"
]
}
159 changes: 123 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
"dependencies": {
"@homebridge/ciao": "^1.1.5",
"@homebridge/dbus-native": "^0.5.0",
"bonjour-hap": "~3.6.3",
"bonjour-hap": "~3.6.4",
"debug": "^4.3.4",
"fast-srp-hap": "2.0.4",
"fast-srp-hap": "~2.0.4",
"futoin-hkdf": "~1.4.3",
"node-persist": "^0.0.11",
"source-map-support": "^0.5.21",
Expand All @@ -71,6 +71,7 @@
"@typescript-eslint/parser": "^5.21.0",
"commander": "^6.2.1",
"escape-html": "^1.0.3",
"http-parser-js": "^0.5.8",
"eslint": "^8.14.0",
"jest": "^27.5.1",
"rimraf": "^3.0.2",
Expand All @@ -79,6 +80,7 @@
"ts-jest": "^27.1.4",
"ts-node": "^10.7.0",
"typedoc": "^0.22.15",
"typescript": "~4.5.4"
"typescript": "~4.5.4",
"axios": "^0.27.2"
}
}
4 changes: 2 additions & 2 deletions src/accessories/Light_accessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {

class LightControllerClass {

name: CharacteristicValue = "Simple Light"; //name of accessory
name = "Simple Light"; //name of accessory
pincode: CharacteristicValue = "031-45-154";
username: CharacteristicValue = "FA:3C:ED:5A:1A:1A"; // MAC like address used by HomeKit to differentiate accessories.
manufacturer: CharacteristicValue = "HAP-NodeJS"; //manufacturer (optional)
Expand Down Expand Up @@ -135,7 +135,7 @@ lightbulb.getCharacteristic(Characteristic.On)
// requests from HomeKit.
callback();
})
// We want to intercept requests for our current power state so we can query the hardware itself instead of
// We want to intercept requests for our current power state, so we can query the hardware itself instead of
// allowing HAP-NodeJS to return the cached Characteristic.value.
.on(CharacteristicEventTypes.GET, (callback: NodeCallback<CharacteristicValue>) => {
callback(null, LightController.getPower());
Expand Down
8 changes: 8 additions & 0 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// we just test that we can import index e.g. without any cyclic imports
import "./index";

describe("index", () => {
test("test index import", () => {
expect(true).toBeTruthy();
});
});
Loading