create test for deserealization of mainbot.js

This commit is contained in:
Akulij 2025-05-18 16:07:40 +03:00
parent 9d5bf86289
commit bf032e6ce4

View File

@ -77,6 +77,16 @@ mod tests {
println!("Val: {:?}", val.to_string());
}
#[test]
fn test_deserialization_main() {
let runner = Runner::init().unwrap();
let val = runner.run_script(include_str!("../mainbot.js")).unwrap();
let s: RunnerConfig = from_js(unsafe { runner.context.context_raw() }, &val).unwrap();
println!("deser: {:#?}", s);
let o = val.try_into_object().unwrap();
println!("o: {:?}", recursive_format(o));
}
fn recursive_format(o: OwnedJsObject) -> String {
let props: Vec<_> = o.properties_iter().unwrap().map(|x| x.unwrap()).collect();
let sp: Vec<String> = props