Skip to content

Commit 6be9568

Browse files
committed
test(template): pin the list of files a new satellite starts with
Generating a repository must produce exactly the expected tree, so adding or dropping a template file is a deliberate change to the test as well.
1 parent 2b26db0 commit 6be9568

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

‎tests/test_new_satellite.py‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,40 @@ def generated(tmp_path: Path) -> Path:
2222
return out
2323

2424

25+
# Everything a new satellite starts with. A template change shows up here, so
26+
# adding, renaming or dropping a generated file is a deliberate edit.
27+
EXPECTED_FILES = [
28+
".github/CODEOWNERS",
29+
".github/pull_request_template.md",
30+
".github/workflows/deploy-pages.yml",
31+
".github/workflows/final-check.yml",
32+
".github/workflows/validate-data.yml",
33+
".gitignore",
34+
"DATA_LICENSE.md",
35+
"LICENSE",
36+
"README.md",
37+
"app/__init__.py",
38+
"app/validate.py",
39+
"pyproject.toml",
40+
"site/.nojekyll",
41+
"site/build.py",
42+
"site/index.html",
43+
"tests/test_validate.py",
44+
]
45+
46+
47+
def test_generated_tree_is_the_expected_file_list(generated: Path):
48+
files = sorted(p.relative_to(generated).as_posix() for p in generated.rglob("*") if p.is_file())
49+
assert files == sorted(EXPECTED_FILES)
50+
assert (generated / "data" / "demo").is_dir()
51+
52+
53+
def test_generated_metadata_is_filled_in(generated: Path):
54+
assert "* @GetTechAPI/maintainers" in (generated / ".github" / "CODEOWNERS").read_text(encoding="utf-8")
55+
template = (generated / ".github" / "pull_request_template.md").read_text(encoding="utf-8")
56+
assert "data(demo):" in template and "{{" not in template
57+
58+
2559
def test_no_placeholder_survives(generated: Path):
2660
for path in generated.rglob("*"):
2761
if path.is_file() and path.suffix in {".py", ".md", ".toml", ".yml", ".html"}:

0 commit comments

Comments
 (0)