useStrictMocks
function in meocord/testing Since 4.2.0
useStrictMocks(): voidHas every mock from meocord/testing compute the values discord.js computes, where it reads a placeholder otherwise.
Call it once in the test runner's setup file. A message's editable, deletable, pinnable, crosspostable,
bulkDeletable, hasThread and partial, a member's manageable, kickable, bannable and moderatable, a
role's editable, a channel's and a thread's viewable, manageable, deletable, joinable and the rest, a voice
channel's full, and partial on users, channels and reactions then run discord.js's own getters against the mock,
and message.thread is null when the channel caches no thread under the message's id. So do a message's
editedAt, a member's presence, a server's verified and systemChannel and a channel's parent, each null or
false until the test gives what it is computed from. A reaction's me is false, a message's
mentions.repliedUser and a modal's message are null, an interaction's ephemeral is null until reply() or
deferReply() decides it, and a reaction has a whole message of its own, so MeoCord's dispatcher fetches neither. No
placeholder warning is logged.
Throws
Error when a mock already exists, which was made without it.
Examples
// vitest.setup.ts
useStrictMocks()