import unittest from pathlib import Path class ProcessEntryOccurrencesTest(unittest.TestCase): def test_process_occurrence_combines_process_and_entry_date(self): source = Path("app.js").read_text(encoding="utf-8") self.assertIn("function processOccurrenceGroupKey(row)", source) self.assertIn("normalizedProcessKey(processKey(row))", source) self.assertIn("rowEntryOccurrenceKey(row)", source) self.assertLess( source.index('row.fields?.["Entrada Equipe"]', source.index("function rowEntryOccurrenceKey")), source.index('row.fields?.["Entrada EAV"]', source.index("function rowEntryOccurrenceKey")), ) def test_sheet_groups_and_metrics_use_occurrences(self): source = Path("app.js").read_text(encoding="utf-8") self.assertIn("const inscriptionsByOccurrence = new Map();", source) self.assertIn("processes: inscriptionsByOccurrence.size", source) self.assertIn("data-process-occurrence-key=", source) if __name__ == "__main__": unittest.main()