Skip to content

Commit

Permalink
Add test for JS class decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
betula committed Jun 25, 2019
1 parent f2a8986 commit 91bcfaf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,20 @@ test("Should work inject as decorator without parameters", () => {
expect(new Z).toBeInstanceOf(Z);
});

test("Should work inject as JS style class decorator", () => {
const spy = jest.fn();
const F = () => ({ n: 10 });
@inject({ a: F })
class A {
constructor() {
expect((this as any).a.n).toBe(10);
spy();
}
}
new A();
expect(spy).toBeCalled();
});

test("Should work assign", () => {
class A {}
class B {}
Expand Down

0 comments on commit 91bcfaf

Please sign in to comment.