Commit d71b6b96 authored by nanahira's avatar nanahira

tests

parent 1acb14fd
...@@ -4,7 +4,11 @@ describe('ProtoMiddlewareDispatcher', () => { ...@@ -4,7 +4,11 @@ describe('ProtoMiddlewareDispatcher', () => {
class Base { class Base {
value: number; value: number;
} }
class Sub extends Base {} class Sub extends Base {
get mutated() {
return this.value * 2;
}
}
it('builds middlewares by prototype chain (prior: Base->Sub, normal: Sub->Base)', async () => { it('builds middlewares by prototype chain (prior: Base->Sub, normal: Sub->Base)', async () => {
const d = new ProtoMiddlewareDispatcher<[res: number]>(); const d = new ProtoMiddlewareDispatcher<[res: number]>();
...@@ -68,5 +72,6 @@ describe('ProtoMiddlewareDispatcher', () => { ...@@ -68,5 +72,6 @@ describe('ProtoMiddlewareDispatcher', () => {
]); ]);
expect(res).toBeInstanceOf(Sub); expect(res).toBeInstanceOf(Sub);
expect(res.value).toBe(9); // 5 + 3 + 1 expect(res.value).toBe(9); // 5 + 3 + 1
expect(res.mutated).toBe(18);
}); });
}); });
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