Details
Details
Diff Detail
Diff Detail
- Repository
- rCOMM Comm
- Lint
No Lint Coverage - Unit
No Test Coverage
Event Timeline
Comment Actions
Let's move logic for construction of message to lib so it can be used across web and native.
native/roles/role-utils.react.js | ||
---|---|---|
40–52 ↗ | (On Diff #29062) | Given we also have something like this for web (D8625), it makes sense to move the construction of this message to lib so it can be kept in sync across platforms. |
Comment Actions
Looks good, thanks for addressing feedback!
lib/utils/role-utils.js | ||
---|---|---|
38–56 ↗ | (On Diff #29096) | Now that we have this pulled out into utils function, we could add some quick unit tests? I think we can just cut/paste these: const { constructRoleDeletionMessagePrompt } = require('./path_to_your_function'); describe('constructRoleDeletionMessagePrompt', () => { it('should return generic deletion message if no members have this role', () => { const result = constructRoleDeletionMessagePrompt('defaultRole', 0); expect(result).toBe('Are you sure you want to delete this role?'); }); it('should correctly format message for single member', () => { const result = constructRoleDeletionMessagePrompt('defaultRole', 1); expect(result).toBe('There is currently 1 member with this role. Deleting the role will automatically assign the member affected to the defaultRole role.'); }); it('should correctly format message for multiple members', () => { const result = constructRoleDeletionMessagePrompt('defaultRole', 5); expect(result).toBe('There are currently 5 members with this role. Deleting the role will automatically assign the members affected to the defaultRole role.'); }); it('should correctly incorporate the name of the default role', () => { const result = constructRoleDeletionMessagePrompt('testRole', 5); expect(result).toBe('There are currently 5 members with this role. Deleting the role will automatically assign the members affected to the testRole role.'); }); }); (https://chat.openai.com/share/4884ee58-a441-43e7-a91e-8433507971fc) |