Commit b1e5696c authored by nanahira's avatar nanahira

add unit test

parent fd43b64a
Pipeline #12511 passed with stages
in 1 minute and 23 seconds
import { Context } from 'koishi';
import { KoishiPluginRegistrationOptions, PluginClass } from '../register';
import { PluginClass } from '../register';
export * from 'koishi-decorators/dist/src/def/interfaces';
......
import { App, Context } from 'koishi';
import { App, Context, Logger } from 'koishi';
import {
DefinePlugin,
OnApply,
OnConnect,
OnDisconnect,
} from '../src/register';
import { Inject, InjectContext, Provide } from '../src/decorators';
import {
Inject,
InjectContext,
Provide,
InjectLogger,
} from '../src/decorators';
declare module 'koishi' {
// eslint-disable-next-line @typescript-eslint/no-namespace
......@@ -32,6 +37,9 @@ class TestingBase implements OnConnect, OnDisconnect, OnApply {
@InjectContext()
ctx: Context;
@InjectLogger()
logger: Logger;
onApply() {
this.applied = true;
}
......@@ -98,4 +106,10 @@ describe('Apply and Connect in koishi-thirdeye', () => {
app.plugin(MyPlugin3);
await RunApplyTest(app);
});
it('should name logger correctly', () => {
app.plugin(MyPlugin);
const myPlugin = app.myPlugin;
expect(myPlugin.logger.name).toBe('MyPlugin');
});
});
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