forked from homebridge/HAP-NodeJS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor to typescript (homebridge#691)
* Add TypeScript to project * move all code to src/ folder * update build scripts and .gitignore * convert codebase to Typescript * exclude test files from output * correct and update types * add tests * use bound functions as class methods * move shared type to types file * enable declaration generation * use bound functions as class methods * fix invalid usage of arguments and self-invocation of `encode()` TLV function * add tests and mock for `bonjour-hap` * remove unnecessary comment * move shared Characteristic types * improve types in all EventEmitter subclasses * export all utility functions and remove superfluous exports * various tidies * add and improve tests * fix typo in comment * add test stubs * add tests for TLV encoding * improve test coverage * replace deprecated Characteristic * add prepublishOnly hook to automatically build Typescript for release
- Loading branch information
1 parent
c11776d
commit bb0c5b9
Showing
83 changed files
with
16,620 additions
and
10,940 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
persist | ||
node_modules | ||
.DS_Store | ||
.idea | ||
dist | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class Advertisement { | ||
updateTxt = jest.fn(); | ||
stop = jest.fn(); | ||
destroy = jest.fn(); | ||
} | ||
|
||
class BonjourService { | ||
publish = jest.fn(() => { | ||
return new Advertisement(); | ||
}); | ||
destroy = jest.fn(); | ||
} | ||
|
||
export default (opts: any) => { | ||
return new BonjourService(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Storage { | ||
getItem = jest.fn(); | ||
setItemSync = jest.fn(); | ||
persistSync = jest.fn(); | ||
removeItemSync = jest.fn(); | ||
} | ||
|
||
export default new Storage(); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.