add test (fails at the moment)

This commit is contained in:
mierenmanz 2021-04-28 15:57:59 +02:00
parent 58ad6fcd3d
commit 1c25e2d3a1

30
test/argsparser_test.ts Normal file
View file

@ -0,0 +1,30 @@
import { parseArgs, Args } from "../src/utils/command.ts";
import { assertEquals } from "https://deno.land/std@0.95.0/testing/asserts.ts"
const commandArgs: Args[] = [{
name: "permaban",
match: "flag",
flag: "--permanent",
}, {
name: "user",
match: "mention",
}, {
name: "reason",
match: "rest",
}];
const messageArgs: string[] = ["<@!708544768342229012>","--permanent","bye","bye","Skyler"];
const expectedResult = {
permaban: true,
user: "708544768342229012",
reason: ["bye","bye","Skyler"]
}
Deno.test({
name: "parse Args",
fn: () => {
const result = parseArgs(commandArgs,messageArgs);
assertEquals(result, expectedResult)
},
sanitizeOps: true,
sanitizeResources: true,
sanitizeExit: true,
})