mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-21 20:21:38 +00:00
Snapshot tests for JSON models
This commit is contained in:
parent
6ef832b3a9
commit
72d88200e4
2 changed files with 31 additions and 23 deletions
|
|
@ -50,7 +50,9 @@ impl SnapshotMiddleware for SnapshotJsonModel {
|
|||
}
|
||||
}
|
||||
|
||||
let snapshot = instance.core.into_snapshot(instance_name);
|
||||
let mut snapshot = instance.core.into_snapshot(instance_name);
|
||||
|
||||
snapshot.metadata.contributing_paths = vec![entry.path().to_path_buf()];
|
||||
|
||||
Ok(Some(snapshot))
|
||||
}
|
||||
|
|
@ -133,6 +135,7 @@ impl JsonModelCore {
|
|||
mod test {
|
||||
use super::*;
|
||||
|
||||
use insta::assert_yaml_snapshot;
|
||||
use maplit::hashmap;
|
||||
use rbx_dom_weak::RbxValue;
|
||||
|
||||
|
|
@ -166,27 +169,6 @@ mod test {
|
|||
.unwrap()
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(
|
||||
instance_snapshot,
|
||||
InstanceSnapshot {
|
||||
snapshot_id: None,
|
||||
metadata: Default::default(), // TODO
|
||||
name: Cow::Borrowed("foo"),
|
||||
class_name: Cow::Borrowed("IntValue"),
|
||||
properties: hashmap! {
|
||||
"Value".to_owned() => RbxValue::Int32 {
|
||||
value: 5,
|
||||
},
|
||||
},
|
||||
children: vec![InstanceSnapshot {
|
||||
snapshot_id: None,
|
||||
metadata: Default::default(), // TODO
|
||||
name: Cow::Borrowed("The Child"),
|
||||
class_name: Cow::Borrowed("StringValue"),
|
||||
properties: HashMap::new(),
|
||||
children: Vec::new(),
|
||||
},],
|
||||
}
|
||||
);
|
||||
assert_yaml_snapshot!(instance_snapshot);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue