/[sudobot]/trunk/tests/framework/arguments/RestStringArgument.test.ts
ViewVC logotype

Contents of /trunk/tests/framework/arguments/RestStringArgument.test.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 575 - (show annotations)
Mon Jul 29 17:59:26 2024 UTC (8 months ago) by rakinar2
File MIME type: application/typescript
File size: 1033 byte(s)
chore: add trunk
1 import RestStringArgument from "@framework/arguments/RestStringArgument";
2 import { beforeEach, describe, expect, it } from "vitest";
3 import { createApplication } from "../../mocks/application.mock";
4 import { initialize } from "./ArgumentTestUtils";
5
6 describe("RestStringArgument", () => {
7 createApplication();
8 let data: ReturnType<typeof initialize>;
9
10 beforeEach(() => {
11 data = initialize({
12 content: "test a b c d e f",
13 userId: "1",
14 guildId: "1",
15 prefix: "!"
16 });
17 });
18
19 it("should parse a rest string argument", async () => {
20 const result = await RestStringArgument.performCast(
21 data.context,
22 data.content,
23 data.argv,
24 data.argv[2],
25 1,
26 "testarg",
27 undefined,
28 true
29 );
30
31 expect(result.value?.getRawValue()).toBe("b");
32 expect(result.value?.getValue()).toBe("b c d e f");
33 expect(result.error).toBeUndefined();
34 });
35 });

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26