use std::path::{Path, PathBuf};
use serde_json::{Value, json};
use crate::channel::entries::{ENTRIES, WIRE};
use crate::channel::hello::PROTOCOL;
use crate::test_support::engine::Engine;
use crate::test_support::{Scratch, mint};
pub(crate) fn wired(scratch: &Scratch, at: &Path, script: Vec<Vec<Value>>) -> Engine {
let dir = scratch.path().join(at);
std::fs::create_dir_all(&dir).expect("mkdir");
mint::material(&dir);
Engine::start(&dir, PROTOCOL, script)
}
pub(crate) fn flat() -> PathBuf {
PathBuf::from(WIRE)
}
pub(crate) fn entry(leaf: &str) -> PathBuf {
flat().join(ENTRIES).join(leaf)
}
pub(crate) fn yes() -> Value {
json!({"ok": true, "kind": "workspaces"})
}