Commit 81886ff8 authored by nanahira's avatar nanahira

tests

parent 080bdb45
Pipeline #10517 passed with stages
in 1 minute and 18 seconds
......@@ -2,14 +2,14 @@ import { TopLevelAction } from '../src/decorators';
import { Registrar } from '../src/register';
import { App } from 'koishi';
@TopLevelAction((ctx, o) => (o.foo = 1))
@TopLevelAction((ctx, o) => (o.bar = 2))
@TopLevelAction((ctx, o) => (o.foo += 1))
@TopLevelAction((ctx, o) => (o.bar += 2))
class MyClass {
foo = 0;
bar = 0;
}
@TopLevelAction((ctx, o) => (o.baz = 3))
@TopLevelAction((ctx, o) => (o.baz += 3))
class MyAnotherClass extends MyClass {
baz = 0;
}
......@@ -31,7 +31,7 @@ describe('Top level action', () => {
it('should be applied to the class and its subclasses', () => {
const instance = new MyAnotherClass();
const registrar = new Registrar(instance);
const registrar = new Registrar(instance, MyClass);
const app = new App();
registrar.performTopActions(app);
expect(instance.foo).toBe(1);
......
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