40 lines
1 KiB
Bash
40 lines
1 KiB
Bash
#!/usr/bin/env bats
|
|
# tests/structure.bats — canonical-structure verify/sync.
|
|
load helpers
|
|
|
|
setup() {
|
|
source "$LIB_DIR/output.sh"
|
|
source "$LIB_DIR/structure.sh"
|
|
}
|
|
|
|
@test "structure_report: a full fixture has no drift" {
|
|
G="$(make_fixture_genome)"
|
|
run structure_report "$G"
|
|
[ "$status" -eq 0 ]
|
|
}
|
|
|
|
@test "structure_report: flags a missing canonical dir" {
|
|
G="$(make_fixture_genome)"
|
|
rm -rf "$G/wiki/private"
|
|
run structure_report "$G"
|
|
[ "$status" -ne 0 ]
|
|
[[ "$output" == *"wiki/private"* ]]
|
|
}
|
|
|
|
@test "structure_report: notes an extra dir but does not fail on it" {
|
|
G="$(make_fixture_genome)"
|
|
mkdir -p "$G/wiki/experiments"
|
|
run structure_report "$G"
|
|
[ "$status" -eq 0 ]
|
|
[[ "$output" == *"experiments"* ]]
|
|
}
|
|
|
|
@test "structure_sync: creates missing dirs and is idempotent" {
|
|
G="$(make_fixture_genome)"
|
|
rm -rf "$G/wiki/private" "$G/raw/transcripts"
|
|
structure_sync "$G"
|
|
[ -d "$G/wiki/private" ] && [ -d "$G/raw/transcripts" ]
|
|
run structure_report "$G"
|
|
[ "$status" -eq 0 ]
|
|
structure_sync "$G" # second run: nothing to do
|
|
}
|