exposed init() to use in tests
This commit is contained in:
parent
0388c9249b
commit
324aeb7cac
@ -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
|
||||
|
||||
@ -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) =
|
||||
|
||||
@ -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",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user