mirror of
https://github.com/esphome/esphome.git
synced 2025-10-25 13:13:48 +01:00
Add basic text_sensor tests (#11424)
This commit is contained in:
66
tests/components/text_sensor/common.yaml
Normal file
66
tests/components/text_sensor/common.yaml
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
text_sensor:
|
||||||
|
- platform: template
|
||||||
|
name: "Test Substitute Single"
|
||||||
|
id: test_substitute_single
|
||||||
|
filters:
|
||||||
|
- substitute:
|
||||||
|
- ERROR -> Error
|
||||||
|
|
||||||
|
- platform: template
|
||||||
|
name: "Test Substitute Multiple"
|
||||||
|
id: test_substitute_multiple
|
||||||
|
filters:
|
||||||
|
- substitute:
|
||||||
|
- ERROR -> Error
|
||||||
|
- WARN -> Warning
|
||||||
|
- INFO -> Information
|
||||||
|
- DEBUG -> Debug
|
||||||
|
|
||||||
|
- platform: template
|
||||||
|
name: "Test Substitute Chained"
|
||||||
|
id: test_substitute_chained
|
||||||
|
filters:
|
||||||
|
- substitute:
|
||||||
|
- foo -> bar
|
||||||
|
- to_upper
|
||||||
|
- substitute:
|
||||||
|
- BAR -> baz
|
||||||
|
|
||||||
|
- platform: template
|
||||||
|
name: "Test Map Single"
|
||||||
|
id: test_map_single
|
||||||
|
filters:
|
||||||
|
- map:
|
||||||
|
- ON -> Active
|
||||||
|
|
||||||
|
- platform: template
|
||||||
|
name: "Test Map Multiple"
|
||||||
|
id: test_map_multiple
|
||||||
|
filters:
|
||||||
|
- map:
|
||||||
|
- ON -> Active
|
||||||
|
- OFF -> Inactive
|
||||||
|
- UNKNOWN -> Error
|
||||||
|
- IDLE -> Standby
|
||||||
|
|
||||||
|
- platform: template
|
||||||
|
name: "Test Map Passthrough"
|
||||||
|
id: test_map_passthrough
|
||||||
|
filters:
|
||||||
|
- map:
|
||||||
|
- Good -> Excellent
|
||||||
|
- Bad -> Poor
|
||||||
|
|
||||||
|
- platform: template
|
||||||
|
name: "Test All Filters"
|
||||||
|
id: test_all_filters
|
||||||
|
filters:
|
||||||
|
- to_upper
|
||||||
|
- to_lower
|
||||||
|
- append: " suffix"
|
||||||
|
- prepend: "prefix "
|
||||||
|
- substitute:
|
||||||
|
- prefix -> PREFIX
|
||||||
|
- suffix -> SUFFIX
|
||||||
|
- map:
|
||||||
|
- PREFIX text SUFFIX -> mapped
|
||||||
1
tests/components/text_sensor/test.esp8266-ard.yaml
Normal file
1
tests/components/text_sensor/test.esp8266-ard.yaml
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<<: !include common.yaml
|
||||||
Reference in New Issue
Block a user