-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test to check for missing assignments of fake passwords
- Loading branch information
Showing
3 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-FileCopyrightText: © 2023 Kevin Lu | ||
// SPDX-Licence-Identifier: AGPL-3.0-or-later | ||
import fs from "fs"; | ||
import path from "path"; | ||
|
||
if (process.argv.length < 3) { | ||
console.error(`Usage: ${process.argv[1]} <data/cards>`); | ||
process.exit(1); | ||
} | ||
|
||
(async () => { | ||
const files = await fs.promises.readdir(process.argv[2]); | ||
const missingFakePasswords = []; | ||
for (const file of files) { | ||
if (file.endsWith(".json")) { | ||
const card = JSON.parse(await fs.promises.readFile(path.join(process.argv[2], file), "utf8")); | ||
if (!card.password && !card.fake_password) { | ||
missingFakePasswords.push(card); | ||
} | ||
} | ||
} | ||
if (missingFakePasswords.length) { | ||
for (const card of missingFakePasswords) { | ||
console.log(`${card.yugipedia_page_id}\t[${card.name.en}]`); | ||
} | ||
process.exit(2); | ||
} | ||
})(); |