Commit a64ea7b0 authored by nanahira's avatar nanahira

nothing large changes

parent c4724ab2
This diff is collapsed.
...@@ -62,6 +62,6 @@ ...@@ -62,6 +62,6 @@
"lodash": "^4.17.21" "lodash": "^4.17.21"
}, },
"peerDependencies": { "peerDependencies": {
"koishi": "^4.9.7" "koishi": "^4.11.0"
} }
} }
import { Context } from 'koishi'; import { App, Context } from 'koishi';
import { Registrar } from 'cordis-decorators'; import { Registrar } from 'cordis-decorators';
import WebSocket from 'ws'; import WebSocket from 'ws';
...@@ -89,4 +89,4 @@ export class SatoriRegistrar<Ctx extends Context> extends Registrar<Ctx> { ...@@ -89,4 +89,4 @@ export class SatoriRegistrar<Ctx extends Context> extends Registrar<Ctx> {
} }
} }
export const defaultRegistrarS = new SatoriRegistrar(Context); export const defaultRegistrarS = new SatoriRegistrar(App);
import { Context } from 'koishi'; import { App } from 'koishi';
import { MapPlugin, MergePlugin } from '../src/plugin-operators'; import { MapPlugin, MergePlugin } from '../src/plugin-operators';
import { SchemaProperty } from 'cordis-decorators'; import { SchemaProperty } from 'cordis-decorators';
import { DefinePlugin, StarterPlugin, UseEvent } from './utility/decorators'; import { DefinePlugin, StarterPlugin, UseEvent } from './utility/decorators';
...@@ -66,7 +66,7 @@ class MergedWearingPlugin extends MergePlugin( ...@@ -66,7 +66,7 @@ class MergedWearingPlugin extends MergePlugin(
describe('register map plugin instance', () => { describe('register map plugin instance', () => {
it('should work on each level', async () => { it('should work on each level', async () => {
const app = new Context(); const app = new App();
app.plugin(WearingPlugin, { app.plugin(WearingPlugin, {
dress: { color: 'red' }, dress: { color: 'red' },
skirt: { size: 'XL' }, skirt: { size: 'XL' },
...@@ -78,7 +78,7 @@ describe('register map plugin instance', () => { ...@@ -78,7 +78,7 @@ describe('register map plugin instance', () => {
expect(app.bail('wearingStrip')).toBe('pink'); expect(app.bail('wearingStrip')).toBe('pink');
}); });
it('should partial register', async () => { it('should partial register', async () => {
const app = new Context(); const app = new App();
app.plugin(WearingPlugin, { app.plugin(WearingPlugin, {
dress: { color: 'red' }, dress: { color: 'red' },
strip: 'pink', strip: 'pink',
...@@ -89,7 +89,7 @@ describe('register map plugin instance', () => { ...@@ -89,7 +89,7 @@ describe('register map plugin instance', () => {
expect(app.bail('skirtSize')).toBe('S'); expect(app.bail('skirtSize')).toBe('S');
}); });
it('should work on merge plugin', async () => { it('should work on merge plugin', async () => {
const app = new Context(); const app = new App();
app.plugin(MergedWearingPlugin, { app.plugin(MergedWearingPlugin, {
color: 'red', color: 'red',
size: 'XL', size: 'XL',
......
import { RegisterSchema, SchemaProperty } from 'cordis-decorators'; import { RegisterSchema, SchemaProperty } from 'cordis-decorators';
import { DefinePlugin, StarterPlugin, UseEvent } from './utility/decorators'; import { DefinePlugin, StarterPlugin, UseEvent } from './utility/decorators';
import { MultiInstancePlugin } from '../src/plugin-operators'; import { MultiInstancePlugin } from '../src/plugin-operators';
import { Context, Schema } from 'koishi'; import { App, Schema } from 'koishi';
declare module 'cordis' { declare module 'cordis' {
interface Events<C> { interface Events<C> {
...@@ -70,7 +70,7 @@ class Outer2 extends MultiInstancePlugin(Inner2, OuterMessageConfig) { ...@@ -70,7 +70,7 @@ class Outer2 extends MultiInstancePlugin(Inner2, OuterMessageConfig) {
describe('register multi plugin instance', () => { describe('register multi plugin instance', () => {
it('should work on schemastery-gen', async () => { it('should work on schemastery-gen', async () => {
const app = new Context(); const app = new App();
app.plugin(Outer, { msg: 'hello', instances: [{ msg: 'world' }] }); app.plugin(Outer, { msg: 'hello', instances: [{ msg: 'world' }] });
await app.start(); await app.start();
expect(app.bail('message1')).toBe('world'); expect(app.bail('message1')).toBe('world');
...@@ -79,7 +79,7 @@ describe('register multi plugin instance', () => { ...@@ -79,7 +79,7 @@ describe('register multi plugin instance', () => {
}); });
it('should work on common schemastery', async () => { it('should work on common schemastery', async () => {
const app = new Context(); const app = new App();
app.plugin(Outer2, { msg: 'hello', instances: [{ msg: 'world' }] }); app.plugin(Outer2, { msg: 'hello', instances: [{ msg: 'world' }] });
await app.start(); await app.start();
expect(app.bail('message1')).toBe('world'); expect(app.bail('message1')).toBe('world');
......
import { OnGuild, OnPlatform } from '../src/decorators'; import { OnGuild, OnPlatform } from '../src/decorators';
import { Context, Session } from 'koishi'; import { App, Session } from 'koishi';
import { defaultRegistrarS } from '../src/registrar'; import { defaultRegistrarS } from '../src/registrar';
@OnPlatform('discord') @OnPlatform('discord')
...@@ -9,10 +9,10 @@ class MyClass { ...@@ -9,10 +9,10 @@ class MyClass {
} }
describe('Scope', () => { describe('Scope', () => {
let app: Context; let app: App;
beforeEach(async () => { beforeEach(async () => {
app = new Context(); app = new App();
await app.start(); await app.start();
}); });
......
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