-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
300 additions
and
222 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,20 +1,18 @@ | ||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; | ||
|
||
export const mockConfigEntries = (hass: MockHomeAssistant) => { | ||
hass.mockWS("config_entries/get_matching", () => [ | ||
{ | ||
entry_id: "co2signal", | ||
domain: "co2signal", | ||
title: "CO2 Signal", | ||
source: "user", | ||
state: "loaded", | ||
supports_options: false, | ||
supports_remove_device: false, | ||
supports_unload: true, | ||
pref_disable_new_entities: false, | ||
pref_disable_polling: false, | ||
disabled_by: null, | ||
reason: null, | ||
}, | ||
]); | ||
hass.mockWS("config_entries/get", () => ({ | ||
entry_id: "co2signal", | ||
domain: "co2signal", | ||
title: "Electricity Maps", | ||
source: "user", | ||
state: "loaded", | ||
supports_options: false, | ||
supports_remove_device: false, | ||
supports_unload: true, | ||
pref_disable_new_entities: false, | ||
pref_disable_polling: false, | ||
disabled_by: null, | ||
reason: null, | ||
})); | ||
}; |
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,16 +1,20 @@ | ||
import { PersistentNotification } from "../../../src/data/persistent_notification"; | ||
import { PersistentNotificationMessage } from "../../../src/data/persistent_notification"; | ||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; | ||
|
||
export const mockPersistentNotification = (hass: MockHomeAssistant) => { | ||
hass.mockWS("persistent_notification/get", () => | ||
Promise.resolve([ | ||
{ | ||
created_at: new Date().toISOString(), | ||
message: "There was motion detected in the backyard.", | ||
notification_id: "demo-1", | ||
title: "Motion Detected!", | ||
status: "unread", | ||
hass.mockWS("persistent_notification/subscribe", (_msg, _hass, onChange) => { | ||
onChange!({ | ||
type: "added", | ||
notifications: { | ||
"demo-1": { | ||
created_at: new Date().toISOString(), | ||
message: "There was motion detected in the backyard.", | ||
notification_id: "demo-1", | ||
title: "Motion Detected!", | ||
status: "unread", | ||
}, | ||
}, | ||
] as PersistentNotification[]) | ||
); | ||
} as PersistentNotificationMessage); | ||
return () => {}; | ||
}); | ||
}; |
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
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
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
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
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
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
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
Oops, something went wrong.