From eb9f00c97a77518d76e5973b8c2c10fac6718795 Mon Sep 17 00:00:00 2001 From: Jon <66625200+Kyro3400@users.noreply.github.com> Date: Sun, 17 Nov 2024 16:33:15 -0500 Subject: [PATCH] Update records.test.js --- tests/records.test.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/records.test.js b/tests/records.test.js index 2c2ccbff..aeb25e9a 100644 --- a/tests/records.test.js +++ b/tests/records.test.js @@ -121,9 +121,20 @@ t("All files should have valid record types", (t) => { }); }); +function isDirectory(filePath) { + return fs.lstatSync(filePath).isDirectory(); +} + t("All files should not have duplicate record keys", (t) => { files.forEach((file) => { - const data = fs.readJsonSync(path.join(domainsPath, file)); + const filePath = path.join(domainsPath, file); + + // Skip directories + if (isDirectory(filePath)) { + return; + } + + const data = fs.readJsonSync(filePath); const recordKeys = Object.keys(data.record); const uniqueRecordKeys = new Set(recordKeys);