Files
habitica/test/api/v3/integration/groups/POST-groups.test.js
Aleksandr Saitgalin 1823f658c6 update user and group in a transaction when creating a group. fixes #12124 (#13730)
* fix #12124

add a transaction for updating user and group
so the user doesn't lose gems when saving the group fails

* use mongoose transaction helper

use the helper instead of manually commiting/aborting
to deal with transient transaction errors

* increase timeout and add console.log outputs

add some logging to a failing test

* Revert "increase timeout and add console.log outputs"

This reverts commit 0c36aaa55f.

* add a test for gems when guild creation fails

test the transaction in createGroup()
make sure user keeps the gems if group.save() rejects

* fix(test): try suggested delay from PR discussion

Co-authored-by: SabreCat <sabe@habitica.com>
2022-04-29 16:47:17 -05:00

8.8 KiB