Skip to content

Conversation

@tim48-robot
Copy link
Contributor

Problem

updateUserAnswer() merged into userToUpdate.myAnswers[testDocId] without checking if the entry existed, which throws when a cooperator hasn't accepted the invite yet.

Impact

Changing a cooperator’s role can crash with a TypeError and leave the role unchanged.

Solution

  • Guard updateUserAnswer when the entry is missing (no-op instead of crash).
  • Add unit tests for missing and existing myAnswers entries.

Testing

  • npm test

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants