Conversation
iantrich
reviewed
Nov 5, 2018
| @@ -1,4 +1,4 @@ | |||
| const leftPad = (number) => (number < 10 ? `0${number}` : number); | |||
| const leftPad = (num) => (num < 10 ? `0${num}` : num); | |||
iantrich
reviewed
Nov 5, 2018
| @@ -1,7 +1,7 @@ | |||
| /** Return an icon representing a binary sensor state. */ | |||
|
|
|||
| export default function binarySensorIcon(state) { | |||
iantrich
reviewed
Nov 5, 2018
src/common/entity/cover_icon.ts
Outdated
|
|
||
| export default function coverIcon(state) { | ||
| var open = state.state && state.state !== "closed"; | ||
| export default function coverIcon(state: HassEntity) { |
iantrich
reviewed
Nov 5, 2018
src/common/entity/domain_icon.ts
Outdated
| }; | ||
|
|
||
| export default function domainIcon(domain, state) { | ||
| export default function domainIcon(domain: string, state?: string) { |
iantrich
reviewed
Nov 5, 2018
src/common/entity/extract_views.ts
Outdated
| // Return an ordered array of available views | ||
| export default function extractViews(entities) { | ||
| const views = []; | ||
| export default function extractViews(entities: HassEntities) { |
iantrich
reviewed
Nov 5, 2018
| return message + (args.length ? ": " + args.join(",") : ""); | ||
| }; | ||
| // Mock Localize function for testing | ||
| const localize = (message, ...args) => |
iantrich
reviewed
Nov 5, 2018
| it("Localizes binary sensor invalid device class", () => { | ||
| const altLocalize = function(message, ...args) { | ||
| if (message === "state.binary_sensor.invalid_device_class.off") | ||
| const altLocalize = (message, ...args) => { |
iantrich
reviewed
Nov 5, 2018
| it("Localizes unknown sensor value with units", () => { | ||
| const altLocalize = function(message, ...args) { | ||
| if (message === "state.sensor.unknown") return null; | ||
| const altLocalize = (message, ...args) => { |
iantrich
reviewed
Nov 5, 2018
| it("Localizes unavailable sensor value with units", () => { | ||
| const altLocalize = function(message, ...args) { | ||
| if (message === "state.sensor.unavailable") return null; | ||
| const altLocalize = (message, ...args) => { |
iantrich
reviewed
Nov 5, 2018
| it("Localizes sensor value with component translation", () => { | ||
| const altLocalize = function(message, ...args) { | ||
| if (message !== "component.sensor.state.custom_state") return null; | ||
| const altLocalize = (message, ...args) => { |
iantrich
reviewed
Nov 5, 2018
| it("Localizes unavailable", () => { | ||
| const altLocalize = function(message, ...args) { | ||
| if (message === "state.sensor.unavailable") return null; | ||
| const altLocalize = (message, ...args) => { |
Member
|
Looking over other people's changes is hard! 😃 |
Member
Author
|
You're right Ian, I went lazy and didn't add types to all methods, guess I converted too many 🤷♂️ Anyway, new day, new changes and just spend some time polishing this PR and adding the types. |
Member
Author
|
For the types in the test file: they are really just for tests and don't need to have extensive typing. I've used a bunch of |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Convert our tests to TypeScript to unblock #680