qa-shadow-report
Version:
npm package that prints formatted test reports into a google sheet or csv file
22 lines (19 loc) • 767 B
JavaScript
import { getExistingTabTitlesInRange } from '../google/sheetDataMethods/getSheetInfo.js';
import { getTodaysFormattedDate } from './dateFormatting.js';
/**
* Asynchronously checks whether a report for today already exists.
* It fetches all existing sheet titles and checks for a title that matches today's date.
*
* @async
* @returns {Promise<boolean>} Resolves to true if today's report exists, otherwise false.
*/
export const doesTodaysReportExist = async () => {
try {
const existingTabTitles = await getExistingTabTitlesInRange();
const todaysTitle = getTodaysFormattedDate();
return existingTabTitles.includes(todaysTitle);
} catch (error) {
console.error('Error checking if today\'s report exists:', error);
throw error;
}
};