add unit test for config module
This commit is contained in:
parent
4fc398bb26
commit
d1d02c5dfd
2 changed files with 18 additions and 8 deletions
18
test/config_test.gleam
Normal file
18
test/config_test.gleam
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
import config
|
||||||
|
import gleeunit
|
||||||
|
import gleeunit/should
|
||||||
|
|
||||||
|
pub fn main() -> Nil {
|
||||||
|
gleeunit.main()
|
||||||
|
}
|
||||||
|
|
||||||
|
// gleeunit test functions end in `_test`
|
||||||
|
pub fn file_read_test() {
|
||||||
|
let assert Ok(cfg) = config.load_config()
|
||||||
|
|
||||||
|
cfg.mqtt_host
|
||||||
|
|> should.equal("192.168.1.11")
|
||||||
|
|
||||||
|
cfg.mqtt_user
|
||||||
|
|> should.equal("homeassistant")
|
||||||
|
}
|
||||||
|
|
@ -3,11 +3,3 @@ import gleeunit
|
||||||
pub fn main() -> Nil {
|
pub fn main() -> Nil {
|
||||||
gleeunit.main()
|
gleeunit.main()
|
||||||
}
|
}
|
||||||
|
|
||||||
// gleeunit test functions end in `_test`
|
|
||||||
pub fn hello_world_test() {
|
|
||||||
let name = "Joe"
|
|
||||||
let greeting = "Hello, " <> name <> "!"
|
|
||||||
|
|
||||||
assert greeting == "Hello, Joe!"
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue