Commit ab522424 authored by nanahira's avatar nanahira

better unit test

parent 423d76b2
Pipeline #12863 passed with stages
in 1 minute and 8 seconds
......@@ -25,6 +25,7 @@ class MyPlugin2 extends BasePlugin<{
commands: { name: string; return: string }[];
}> {
@For<MyPlugin2>(({ config }) => config.commands)
@If<MyPlugin2>((_, def) => def.name !== 'badthing')
@UseCommand('{{name}}')
onCommand(
@PutValue('{{return}}') returnValue: string,
......@@ -51,6 +52,7 @@ describe('It should register conditionally', () => {
commands: [
{ name: 'foo', return: 'bar' },
{ name: 'bar', return: 'baz' },
{ name: 'badthing', return: 'bad' },
],
prefix: '> ',
});
......@@ -59,5 +61,6 @@ describe('It should register conditionally', () => {
const commandBar = app.command('bar');
expect(await commandFoo.execute({})).toBe('> bar');
expect(await commandBar.execute({})).toBe('> baz');
expect(await app.command('badthing').execute({})).toBeFalsy();
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment