Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions test/command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,34 @@ describe("Command", () => {
});
});

describe("ctx.match", async () => {
it("should imitate behavior of https://grammy.dev/guide/commands#arguments", async () => {
const command = new Command("cmd", "test", (ctx) => {
assertEquals(ctx.match, "payload");
});

const composer = new Composer();
composer.use(command);

let ctx = new Context(
{ ...update, message: { ...m, text: "/cmd payload" } } as Update,
api,
me,
);
await composer.middleware()(ctx, () => Promise.resolve());

ctx = new Context(
{
...update,
message: { ...m, text: `/cmd@${me.username} payload` },
} as Update,
api,
me,
);
await composer.middleware()(ctx, () => Promise.resolve());
});
});

describe("addToScope", () => {
// NOTE: currently the scopes need to be added in a priority order for the
// narrowest function to be called
Expand Down
Loading