mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-20 20:55:50 +00:00
Add ServeSession test for project with folder
This commit is contained in:
@@ -197,6 +197,7 @@ mod serve_session {
|
||||
use std::{path::PathBuf, time::Duration};
|
||||
|
||||
use insta::assert_yaml_snapshot;
|
||||
use maplit::hashmap;
|
||||
use rojo_insta_ext::RedactionMap;
|
||||
use tokio::{runtime::Runtime, timer::Timeout};
|
||||
|
||||
@@ -217,6 +218,33 @@ mod serve_session {
|
||||
assert_yaml_snapshot!(view_tree(&session.tree(), &mut rm));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn project_with_folder() {
|
||||
let mut imfs = Imfs::new(NoopFetcher);
|
||||
|
||||
imfs.debug_load_snapshot(
|
||||
"/foo",
|
||||
ImfsSnapshot::dir(hashmap! {
|
||||
"default.project.json" => ImfsSnapshot::file(r#"
|
||||
{
|
||||
"name": "HelloWorld",
|
||||
"tree": {
|
||||
"$path": "src"
|
||||
}
|
||||
}
|
||||
"#),
|
||||
"src" => ImfsSnapshot::dir(hashmap! {
|
||||
"hello.txt" => ImfsSnapshot::file("Hello, world!"),
|
||||
}),
|
||||
}),
|
||||
);
|
||||
|
||||
let session = ServeSession::new(imfs, "/foo", None);
|
||||
|
||||
let mut rm = RedactionMap::new();
|
||||
assert_yaml_snapshot!(view_tree(&session.tree(), &mut rm));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn change_txt_file() {
|
||||
let (state, fetcher) = TestFetcher::new();
|
||||
|
||||
30
src/snapshots/serve_session__project_with_folder.snap
Normal file
30
src/snapshots/serve_session__project_with_folder.snap
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
source: src/serve_session.rs
|
||||
expression: "view_tree(&session.tree(), &mut rm)"
|
||||
---
|
||||
id: id-1
|
||||
name: HelloWorld
|
||||
class_name: Folder
|
||||
properties: {}
|
||||
metadata:
|
||||
ignore_unknown_instances: false
|
||||
instigating_source:
|
||||
Path: /foo/default.project.json
|
||||
relevant_paths:
|
||||
- /foo/src
|
||||
- /foo/default.project.json
|
||||
children:
|
||||
- id: id-2
|
||||
name: hello
|
||||
class_name: StringValue
|
||||
properties:
|
||||
Value:
|
||||
Type: String
|
||||
Value: "Hello, world!"
|
||||
metadata:
|
||||
ignore_unknown_instances: false
|
||||
instigating_source:
|
||||
Path: /foo/src/hello.txt
|
||||
relevant_paths:
|
||||
- /foo/src/hello.txt
|
||||
children: []
|
||||
Reference in New Issue
Block a user