fix(anatomy): R5.3 shapes refused as Zod did (struct as array, enum as map), reads bounded to regular files, --check never follows links, plain names in --out
This commit is contained in:
1 parent
314cf04e6a
commit
776c7095b3
9 files changed
+258
-25
No files matched your search
@@ -422,9 +422,9 @@ fn the_synthetic_cases_match_the_typescript_or_are_refused_alike() {
|
||||
"{name} seed"
|
||||
);
|
||||
}
|
||||
assert_eq!((compared, refused), (11, 52));
|
||||
assert_eq!((compared, refused), (11, 62));
|
||||
let reference_cases = frozen["reference_cases"].as_array().unwrap();
|
||||
assert_eq!(reference_cases.len(), 5);
|
||||
assert_eq!(reference_cases.len(), 7);
|
||||
for case in reference_cases {
|
||||
let name = case["name"].as_str().unwrap();
|
||||
let outcome = parse_references(&to_js_compact(&case["file"]).unwrap());
|
||||
@@ -657,7 +657,8 @@ fn import_equine(args: &[&str]) -> (i32, String) {
|
||||
}
|
||||
|
||||
/// Fixed fixtures under the test target's temporary folder: created once, never deleted, and
|
||||
/// never written by the refusals checked here.
|
||||
/// never written by the refusals checked here. The seed refusal is tested on the pure check
|
||||
/// (`inside`, unit test of the binary): a regression must never write into the real seed.
|
||||
fn out_fixtures() -> std::path::PathBuf {
|
||||
let base = std::path::Path::new(env!("CARGO_TARGET_TMPDIR")).join("import-equine-out");
|
||||
for folder in ["empty", "full"] {
|
||||
@@ -676,11 +677,6 @@ fn out_fixtures() -> std::path::PathBuf {
|
||||
fn out_refuses_every_unsafe_destination_and_writes_nothing() {
|
||||
let base = out_fixtures();
|
||||
let at = |rest: &str| format!("{}/{rest}", base.display());
|
||||
let seed = std::fs::canonicalize(common::repo_path("supabase/seed/anatomical-sheets/equine"))
|
||||
.unwrap()
|
||||
.join("new-folder")
|
||||
.display()
|
||||
.to_string();
|
||||
let cases = [
|
||||
(at("link"), "a symbolic link"),
|
||||
(at("link/"), "a symbolic link"),
|
||||
@@ -689,7 +685,6 @@ fn out_refuses_every_unsafe_destination_and_writes_nothing() {
|
||||
(at("full"), "not empty"),
|
||||
(at("empty/../new"), "`..` is not accepted"),
|
||||
(at("absent/new"), "the parent folder does not exist"),
|
||||
(seed.clone(), "inside the seed folder"),
|
||||
];
|
||||
for (path, why) in &cases {
|
||||
let (code, stderr) = import_equine(&["--out", path]);
|
||||
@@ -698,6 +693,5 @@ fn out_refuses_every_unsafe_destination_and_writes_nothing() {
|
||||
}
|
||||
assert_eq!(std::fs::read_dir(base.join("empty")).unwrap().count(), 0);
|
||||
assert_eq!(std::fs::read_dir(base.join("full")).unwrap().count(), 1);
|
||||
assert!(std::fs::symlink_metadata(&seed).is_err());
|
||||
assert!(std::fs::symlink_metadata(base.join("absent")).is_err());
|
||||
}
|
||||
Reference in new issue
Block a user