exposed init() to use in tests

This commit is contained in:
Ivan Yuriev 2024-12-13 20:31:03 +03:00
parent 0388c9249b
commit 324aeb7cac
4 changed files with 5 additions and 5 deletions

View File

@ -18,7 +18,7 @@ import spinner
import tree_events
pub fn main() {
let forest = init()
let forest = init("./treevault.json")
io.println(
"Hello from Treevault! 🌳\n
@ -29,8 +29,8 @@ pub fn main() {
read_next(forest)
}
pub fn init() {
let config = config.load("./config.json") |> io.debug
pub fn init(config_path) {
let config = config.load(config_path) |> io.debug
let forest = case forest.load(config.snapshots_path, config.forest) {
Error(err) -> {
let reason = err |> string.inspect

View File

@ -9,7 +9,7 @@ pub fn main() {
}
pub fn server_test() {
process.start(fn() { treevault.init() }, True)
process.start(fn() { treevault.init("non-existent-file.json") }, True)
process.sleep(2000)
let assert Ok(socket) =

View File

@ -73,7 +73,7 @@ pub fn json_test() {
}
pub fn config_test() {
let config = config.load("./test/vault.json")
let config = config.load("./test/treevault.json")
should.equal(
config.Config("./test/snapshots", 12_345, [
"tree0", "tree1", "tree2", "tree3", "tree4", "tree5", "tree6", "tree7",