mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-15 05:55:32 +00:00
Tests: the sweeps' recorded steps keep a path only where the command takes it
nested_locations_keep_command_meaning expected object.setLiveShape's `path` in a recorded step to stay as sent, but that command does not take a `path` param, so the step reads the key as a file and the sweep sends the temp location. The case now expects that, and text.createInPath, whose `path` is the id of a path in the document, covers a key that names part of the document.
This commit is contained in:
@@ -626,7 +626,9 @@ mod tests {
|
||||
|
||||
/// The strings the sweeps send keep the meaning the command gives their key, at every depth: an
|
||||
/// export's folder grouping and a web link stay as sent, also inside a `command.batch` step and
|
||||
/// a recorded step, and a real file or folder key there goes to the temp location.
|
||||
/// a recorded step, and a real file or folder key there goes to the temp location. A key that names
|
||||
/// part of the document in a recorded step's command stays, and the same key in a command that
|
||||
/// doesn't take it as a param names a file.
|
||||
#[test]
|
||||
fn nested_locations_keep_command_meaning() {
|
||||
let spec = |id: &str| command_specs().iter().find(|c| c.id == id).unwrap_or_else(|| panic!("no command {id}"));
|
||||
@@ -649,10 +651,14 @@ mod tests {
|
||||
{"command": "object.path.simplify", "params": {"wholePaths": "junk"}},
|
||||
])
|
||||
);
|
||||
let recorded = json!([["object.setLiveShape", {"path": "junk"}], ["document.compare", {"diffPath": "junk"}]]);
|
||||
let recorded = json!([
|
||||
["text.createInPath", {"path": "junk"}],
|
||||
["object.setLiveShape", {"path": "junk"}],
|
||||
["document.compare", {"diffPath": "junk"}],
|
||||
]);
|
||||
assert_eq!(
|
||||
safe_value("steps", &recorded, safe),
|
||||
json!([["object.setLiveShape", {"path": "junk"}], ["document.compare", {"diffPath": safe}]])
|
||||
json!([["text.createInPath", {"path": "junk"}], ["object.setLiveShape", {"path": safe}], ["document.compare", {"diffPath": safe}]])
|
||||
);
|
||||
assert_eq!(safe_value("url", &json!("https://example.com/a"), safe), json!("https://example.com/a"));
|
||||
assert_eq!(safe_value("destinationFolder", &json!("junk"), safe), json!("/tmp/sweep/out.bin-folder"));
|
||||
|
||||
Reference in New Issue
Block a user