From add460c3ccd52ebba79d739f7748e7d8459e192c Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Tue, 3 Dec 2024 15:05:47 +0000 Subject: [PATCH] style: apply stylua formatter --- src/generators/rojo/sync_config.luau | 12 +++-- src/generators/rojo/sync_config.spec.luau | 66 +++++++++++------------ 2 files changed, 41 insertions(+), 37 deletions(-) diff --git a/src/generators/rojo/sync_config.luau b/src/generators/rojo/sync_config.luau index cc6f95a..7b06134 100644 --- a/src/generators/rojo/sync_config.luau +++ b/src/generators/rojo/sync_config.luau @@ -56,10 +56,14 @@ local PLATFORM_SEP = if process.os == "windows" then "\\" else "/" --- ## Errors --- * The current process lacks permissions to a file --- * Any I/O error occurs -return function(packageDirectory: string?, files: { string }, options: { - writeToFile: boolean?, - force: boolean?, -}): (boolean, string?) +return function( + packageDirectory: string?, + files: { string }, + options: { + writeToFile: boolean?, + force: boolean?, + } +): (boolean, string?) packageDirectory = packageDirectory or process.cwd local syncConfigPath = `{packageDirectory}{PLATFORM_SEP}default.project.json` if fs.isFile(syncConfigPath) and not options.force then diff --git a/src/generators/rojo/sync_config.spec.luau b/src/generators/rojo/sync_config.spec.luau index 6069bb3..02a5844 100644 --- a/src/generators/rojo/sync_config.spec.luau +++ b/src/generators/rojo/sync_config.spec.luau @@ -1,33 +1,33 @@ -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_DIRS = { - "./test-files/rojo/test-projects", - "./test-files/rojo/rojo-test/serve-tests", -} - -return function(test: typeof(frktest.test)) - test.suite("Generates Rojo valid sync configs", function() - for _, dir in TEST_PROJECTS_DIRS do - for _, file in fs.readDir(dir) do - local fullPath = `{dir}/{file}` - test.case(`{file}`, 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) -end +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_DIRS = { + "./test-files/rojo/test-projects", + "./test-files/rojo/rojo-test/serve-tests", +} + +return function(test: typeof(frktest.test)) + test.suite("Generates Rojo valid sync configs", function() + for _, dir in TEST_PROJECTS_DIRS do + for _, file in fs.readDir(dir) do + local fullPath = `{dir}/{file}` + test.case(`{file}`, 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) +end