createMockUser
function in meocord/testing Since 4.0.0
createMockUser(props?: MockProps<User>): DeepMocked<User>Creates a mock User: a person, not a bot, with an id of its own.
Use it for the user a command acts on, such as a user option's value, or a message's author.
Parameters
| Name | Type | Since |
|---|---|---|
props? | MockProps<User> | 4.2.1 |
Values for the user's properties, such as | ||
Returns
DeepMocked<User>Examples
import { expect } from 'vitest'
const target = createMockUser()
const interaction = createMockInteraction(ChatInputCommandInteraction, {
commandName: 'profile',
options: createChatInputOptions({ target }),
})
expect(interaction.options.getUser('target')).toBe(target)