Skip to content

Commit

Permalink
improve int test
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed Feb 3, 2024
1 parent e880682 commit 3ca8041
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion test/integration/middlewares.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ describe("Test middleware system", () => {
});
};
}
},
{
call(next) {
return (actionName, params, opts) => {
return next(actionName, params, opts).then(res => {
return Promise.resolve(res + "!");
});
};
}
}
]
});
Expand Down Expand Up @@ -48,7 +57,10 @@ describe("Test middleware system", () => {
afterAll(() => broker.stop());

it("The context is passed through the call middlware.", async () => {
await expect(broker.call("test.testAction")).resolves.toBe("testmeta");
const p = broker.call("test.testAction");
await expect(p).resolves.toBe("testmeta!");
expect(p.ctx).toBeDefined();
expect(p.ctx.meta.$metainfo).toBe("testmeta");
});
});

Expand Down

0 comments on commit 3ca8041

Please sign in to comment.