Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Sep 22, 2023
1 parent 518fa8b commit ee49d93
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 22 deletions.
21 changes: 13 additions & 8 deletions crates/pdk-test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,21 @@ pub fn create_plugin(id: &str, sandbox: &Path) -> WasmTestWrapper {
internal_create_plugin(id, sandbox, HashMap::new())
}

#[cfg(feature = "schema")]
#[allow(unused_variables)]
pub fn create_schema_plugin(id: &str, sandbox: &Path, schema: PathBuf) -> WasmTestWrapper {
let schema = fs::read_to_string(schema).unwrap();
let schema: serde_json::Value = toml::from_str(&schema).unwrap();

#[allow(unused_mut)]
let mut config = HashMap::new();
config.insert(
"schema".to_string(),
serde_json::to_string(&schema).unwrap(),
);

#[cfg(feature = "schema")]
{
let schema = fs::read_to_string(schema).unwrap();
let schema: serde_json::Value = toml::from_str(&schema).unwrap();

config.insert(
"schema".to_string(),
serde_json::to_string(&schema).unwrap(),
);
}

internal_create_plugin(id, sandbox, config)
}
Expand Down
65 changes: 51 additions & 14 deletions plugins/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ee49d93

Please sign in to comment.