add unit test for config module

This commit is contained in:
Travis Shears 2026-03-23 14:27:41 +01:00
parent 4fc398bb26
commit d1d02c5dfd
Signed by: travisshears
GPG key ID: CB9BF1910F3F7469
2 changed files with 18 additions and 8 deletions

18
test/config_test.gleam Normal file
View 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")
}

View file

@ -3,11 +3,3 @@ import gleeunit
pub fn main() -> Nil {
gleeunit.main()
}
// gleeunit test functions end in `_test`
pub fn hello_world_test() {
let name = "Joe"
let greeting = "Hello, " <> name <> "!"
assert greeting == "Hello, Joe!"
}