UNPKG

qa-shadow-report

Version:

npm package that prints formatted test reports into a google sheet or csv file

58 lines (47 loc) 1.9 kB
import { jest } from '@jest/globals'; import { doesTodaysReportExist } from './dailyReportRequired.js'; import { getTodaysFormattedDate } from './dateFormatting.js'; // Mock dependencies jest.mock('./dateFormatting.js'); jest.mock('../google/googleSheetIntegration/getSheetData.js'); describe('Daily Report Required', () => { const mockDate = 'Mar 20, 2024'; const mockExistingTitles = ['Mar 20, 2024', 'Mar 19, 2024']; beforeEach(() => { jest.clearAllMocks(); // Setup default mock implementations getTodaysFormattedDate.mockReturnValue(mockDate); }); it.skip("should return true when today's report exists", async () => { const result = await doesTodaysReportExist(); expect(result).toBe(true); expect(getTodaysFormattedDate).toHaveBeenCalled(); }); it.skip("should return false when today's report does not exist", async () => { const result = await doesTodaysReportExist(); expect(result).toBe(false); }); it.skip('should handle empty tab titles list', async () => { const result = await doesTodaysReportExist(); expect(result).toBe(false); }); it.skip('should handle case-insensitive title matching', async () => { const result = await doesTodaysReportExist(); expect(result).toBe(true); }); it.skip('should handle whitespace in titles', async () => { const result = await doesTodaysReportExist(); expect(result).toBe(true); }); it.skip('should handle error from getExistingTabTitlesInRange', async () => { const error = new Error('API Error'); await expect(doesTodaysReportExist()).rejects.toThrow(error); }); it.skip('should handle error from getTodaysFormattedDate', async () => { const error = new Error('Date Error'); getTodaysFormattedDate.mockImplementation(() => { throw error; }); await expect(doesTodaysReportExist()).rejects.toThrow(error); }); });