From c2380f9b24bd2b735952f3cd6cd862b2404ead77 Mon Sep 17 00:00:00 2001 From: William Harrison Date: Tue, 29 Nov 2022 10:39:36 +0800 Subject: [PATCH] prettier --- tests/json.test.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/json.test.js b/tests/json.test.js index 614f73b..011b781 100644 --- a/tests/json.test.js +++ b/tests/json.test.js @@ -3,25 +3,29 @@ const getJSON = require('../utils/getJSON.js'); const checkInfo = require('../utils/checkInfo.js'); const checkRecords = require('../utils/checkRecords.js'); const data = getJSON(process.env.FILES); + if (data == false) { core.setOutput('shouldComment', 'false') console.log('Not a subdomain file') process.exit(0) } + core.setOutput('infoMessage', "Could not validate info."); core.setOutput('recordMessage', "Could not validate records."); core.setOutput('jsonData', data) core.setOutput('shouldComment', 'true') test('check if json file has required info', async () => { const passed = await checkInfo(data); - let infoMessage = passed === true ? "Valid Info Provided." : passed === "unknown" ? "Error Verifying Email.\nA maintainer will have to manually verify your email.\nReason:" : "Invalid Info Provided.\nPlease check your provided info.\nReason:"; + let infoMessage = passed === true ? "Valid information provided." : passed === "unknown" ? "Error verifying email address.\nA maintainer will have to manually verify your email address.\nReason:" : "Invalid information provided.\nPlease check your provided information.\nReason:"; + core.setOutput('infoMessage', infoMessage); expect(passed).toBeTruthy(); }, 15000); -test('check if json file follows format', () => { +test('Check if JSON file follows format', () => { const passed = checkRecords(data); - let recordMessage = passed === true ? "Valid Records Provided." : "Invalid Records Provided.\nPlease check your provided records.\nThey should only be of type `CNAME` or `A` or `TXT`, and should follow their respective formats."; + let recordMessage = passed === true ? "Valid records provided." : "Invalid records provided.\nPlease check your provided records.\nThey should only be of type `A`, `CNAME` or `TXT`, and should follow their respective formats."; + core.setOutput('recordMessage', recordMessage); expect(passed).toBe(true); });