add mention tests

This commit is contained in:
mierenmanz 2021-04-29 19:34:16 +02:00
parent 54b0356a72
commit a8bb3cc49b

View file

@ -95,7 +95,7 @@ const expectedResult3 = {
} }
Deno.test({ Deno.test({
name: 'parse command arguments 3 (assertNotEquals)', name: 'parse command arguments default value (assertNotEquals)',
fn: () => { fn: () => {
const result = parseArgs(commandArgs, messageArgs3) const result = parseArgs(commandArgs, messageArgs3)
assertNotEquals(result, expectedResult3) assertNotEquals(result, expectedResult3)
@ -104,3 +104,50 @@ Deno.test({
sanitizeResources: true, sanitizeResources: true,
sanitizeExit: true sanitizeExit: true
}) })
const commandArgs2: Args[] = [
{
name: 'user',
match: 'mentionUser'
},
{
name: 'channel',
match: 'mentionChannel'
},
{
name: 'role',
match: 'mentionRole',
},
{
name: 'reason',
match: 'rest',
defaultValue: 'ree'
}
]
const messageArgs4: string[] = [
'<@!708544768342229012>',
'bye',
'<#783319033730564098>',
'<@&836715188690092032>'
]
const expectedResult4 = {
channel: "783319033730564098",
role: "836715188690092032",
user: "708544768342229012",
reason: ["bye"]
}
Deno.test({
name: 'parse command arguments mentions (assertEquals)',
fn: () => {
const result = parseArgs(commandArgs2, messageArgs4)
assertEquals(result, expectedResult4)
},
sanitizeOps: true,
sanitizeResources: true,
sanitizeExit: true
})