-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Add is admin utility #567
Feat: Add is admin utility #567
Conversation
0819dee
to
a1f834f
Compare
a1f834f
to
cb727ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work!
Further to the two points below, we also don't actually need the @discordjs/collection
package. discord.js
already exports Collection
(which comes from their utility package), so we can just destructure Collection
from the import, then when mocking 'discord.js'
, just have ...jest.requireActual('discord.js'),
before our mocked properties.
e.g.
jest.mock('discord.js', () => ({
...jest.requireActual('discord.js'),
Member: jest.fn().mockImplementation((roles) => ({
roles: {
cache: roles,
},
})),
}));
And the equivalent for points.test.js
Co-authored-by: MaoShizhong <[email protected]>
✅ Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very much a nit, but mind renaming any memberMap
variables in both test files to memberCollection
?
Once that's done, the rest looks good to me! 🙏
e26a3a1
to
90e60fe
Compare
Co-authored-by: MaoShizhong <[email protected]>
✅ |
I didn't even realise I didn't formally approve. Well that's something to address. |
Because
This PR
isAdmin(member)
utilityMap()
for mocking inpoints.test.js
to useCollection()
insteadIssue
Closes #566
Pull Request Requirements
- [] The title of this PR follows thelocation of change: brief description of change
format, e.g.Callbacks command: Update verbiage
Because
section summarizes the reason for this PRThis PR
section has a bullet point list describing the changes in this PRIssue
section