fix: pretty-print json on serialisation to filesystem

This commit is contained in:
2026-05-30 21:58:31 +02:00
parent c1b7ceae6c
commit 70d2342274
4 changed files with 11 additions and 3 deletions

View File

@@ -99,6 +99,10 @@ defmodule BDS.MetadataTest do
category_meta_path = Path.join([temp_dir, "meta", "category-meta.json"])
publishing_path = Path.join([temp_dir, "meta", "publishing.json"])
assert File.read!(categories_path) =~ "\n"
assert File.read!(category_meta_path) =~ "\n"
assert File.read!(publishing_path) =~ "\n"
assert ["article", "aside", "news", "page", "picture"] =
Jason.decode!(File.read!(categories_path))

View File

@@ -30,8 +30,12 @@ defmodule BDS.TagsTest do
tags_path = Path.join([temp_dir, "meta", "tags.json"])
assert File.exists?(tags_path)
contents = File.read!(tags_path)
assert contents =~ "\n"
refute String.contains?(contents, "}],[")
assert [%{"name" => "Alpha"}, %{"color" => "#000000", "name" => "Zebra"}] =
Jason.decode!(File.read!(tags_path))
Jason.decode!(contents)
end
test "create_tag rejects case-insensitive duplicates per project", %{project: project} do