Add test for ensuring that scripts can be disabled with .meta.json files

This commit is contained in:
Lucien Greathouse
2019-10-08 15:46:51 -07:00
parent 709cba45ce
commit f83abe15cb
2 changed files with 45 additions and 0 deletions

View File

@@ -243,4 +243,27 @@ mod test {
assert_yaml_snapshot!(instance_snapshot);
}
#[test]
fn script_disabled() {
let mut imfs = Imfs::new(NoopFetcher);
let file = ImfsSnapshot::file("Hello there!");
let meta = ImfsSnapshot::file(
r#"
{
"properties": {
"Disabled": true
}
}
"#,
);
imfs.debug_load_snapshot("/bar.server.lua", file);
imfs.debug_load_snapshot("/bar.meta.json", meta);
let entry = imfs.get("/bar.server.lua").unwrap();
let instance_snapshot = SnapshotLua::from_imfs(&mut imfs, &entry).unwrap().unwrap();
assert_yaml_snapshot!(instance_snapshot);
}
}

View File

@@ -0,0 +1,22 @@
---
source: src/snapshot_middleware/lua.rs
expression: instance_snapshot
---
snapshot_id: ~
metadata:
ignore_unknown_instances: false
instigating_source:
Path: /bar.server.lua
relevant_paths:
- /bar.server.lua
- /bar.meta.json
name: bar
class_name: Script
properties:
Disabled:
Type: Bool
Value: true
Source:
Type: String
Value: Hello there!
children: []