Moves the code that checks whether the user has won. It used to live within the sendEmail, deep within the call stack for sending a chat message. I've brought it right out to the top level.
Notes
moves checkLevelWinCondition and checkSubjectAndBodyContains from email.ts to a new file winCondition.ts.
calls checkLevelWinCondition from handleChatToGPT.
wonLevel no longer being passed all the way back up through the call stack.
converts a few interface definitions to type definitions.
testing for winning a level is now handled in the unit tests for winCondition.ts and chatController.ts.
Description
Moves the code that checks whether the user has won. It used to live within the
sendEmail
, deep within the call stack for sending a chat message. I've brought it right out to the top level.Notes
checkLevelWinCondition
andcheckSubjectAndBodyContains
from email.ts to a new file winCondition.ts.checkLevelWinCondition
fromhandleChatToGPT
.wonLevel
no longer being passed all the way back up through the call stack.Checklist
Have you done the following?