scripts/src/generators/argon/sync_config.spec.luau
Erica Marigold d2c41e0d03
feat: include argon core logic in library
* Include sourcemap, and sync config generators for Argon as a sync
  tool.
* Add tests for aforementioned Argon generators.
* Refactor and fix test discovery logic in test runner script.
* Temporarily unpin fixed pesde version.
2024-12-18 12:32:16 +00:00

39 lines
1 KiB
Text

local fs = require("@lune/fs")
local serde = require("@lune/serde")
local frktest = require("../../../lune_packages/frktest")
local check = frktest.assert.check
local syncConfig = require("./sync_config")
local TEST_PROJECTS_DIR = "./test-files/argon"
return function(test: typeof(frktest.test))
test.suite("Generates valid Argon sync configs", function()
for _, dir in fs.readDir(TEST_PROJECTS_DIR) do
local fullPath = `{TEST_PROJECTS_DIR}/{dir}`
if not fs.isDir(fullPath) or dir == ".git" then
continue
end
test.case(`{dir}`, function()
local ok, config = syncConfig(
fullPath,
fs.readDir(fullPath),
{ writeToFile = false, force = true }
)
check.is_true(ok)
-- Make sure that the generated config and the real configs are similar
local generatedConfig, realConfig =
serde.decode("json", config),
serde.decode(
"json",
fs.readFile(`{fullPath}/default.project.json`)
)
check.table.contains(realConfig, generatedConfig)
end)
end
end)
end