ubiquity-os-marketplace / text-conversation-rewards

1 stars 27 forks source link

feat: retry plugin #67

Closed whilefoo closed 4 months ago

whilefoo commented 4 months ago

resolves #66

whilefoo commented 4 months ago

@gentlementlegen I think something changed and now tests are failing.

● Rewards tests › Should split the rewards between multiple assignees

    expect(received).toEqual(expected) // deep equality

    - Expected  - 8
    + Received  + 8

    @@ -82,17 +82,17 @@
                    "p": Object {
                      "count": 24,
                      "score": 1,
                    },
                  },
    -             "formattingMultiplier": 0.25,
    +             "formattingMultiplier": 1,
                  "wordValue": 0.1,
                },
                "relevance": 0.8,
    -           "reward": 0.48,
    +           "reward": 1.92,
              },
    -         "type": "ISSUE|CONTRIBUTOR|COMMENTED",
    +         "type": "ISSUE|COLLABORATOR|COMMENTED",
              "url": "https://github.com/ubiquity/work.ubq.fi/issues/69#issuecomment-2186805818",
            },
            Object {
              "content": "Ah yes because it doesn't apply the `0.5` multiplier I see. Will fix that on v2.",
              "score": Object {
    @@ -105,24 +105,24 @@
                    "p": Object {
                      "count": 16,
                      "score": 1,
                    },
                  },
    -             "formattingMultiplier": 0.25,
    +             "formattingMultiplier": 1,
                  "wordValue": 0.1,
                },
                "relevance": 0.8,
    -           "reward": 0.34,
    +           "reward": 1.36,
              },
    -         "type": "ISSUE|CONTRIBUTOR|COMMENTED",
    +         "type": "ISSUE|COLLABORATOR|COMMENTED",
              "url": "https://github.com/ubiquity/work.ubq.fi/issues/69#issuecomment-2186813200",
            },

It changed from CONTRIBUTOR to COLLABORATOR so that's why rewards are different.

Why are we testing on real Github issues, it seems prone to bugs like these? Is there any particular reason why we can't mock github issues and comments? I still haven't figured out how to run tests on my local machine so I have to rely on Github actions :D

gentlementlegen commented 4 months ago

@whilefoo It must be because I figured out yesterday that if a user has the organization in private, the bot would consider that you are a contributor and not a collaborator. So now that I made it public so I became a COLLABORATOR.

These tests were not mocked somehow hence the difference now. You can see in the conflicts that I made the required changes to mock all of these so this should not happen anymore.

PS: sorry for the conflicts

gentlementlegen commented 4 months ago

@whilefoo The logic works however the posted message is wrong (test run here) so you might want to serialize the object.

gentlementlegen commented 4 months ago

Seems to work fine: https://github.com/Meniole/conversation-rewards/issues/6#issuecomment-2254974922