Replies: 1 comment 9 replies
-
Hi there! I think you can workaround this issue in tests by using describe('Controller: CalculatorController', () => {
let instance: FastifyInstanceWithController<CalculatorController>;
const myService = {someFunction: jest.fn()};
beforeAll(async () => {
instance = await configureControllerTest({
controller: CalculatorController,
mocks: [
{
provide: MyService,
useValue: myService,
},
],
plugins: [
(instance) => instance.addSchema(authorizationHeaderSchema)
]
});
});
}); If this schema comming from another plugin then you can replace this "self written plugin" with actual one |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm having trouble while testing my app, if I start my application it loads the schemas correctly and they're working.
But when I run the tests it throws the following error: FastifyError: Failed building the validation schema for GET: /api/lorem/ipsum, due to error can't resolve reference default.authorization.header# from id #
The test fails in the before all when creating the configureControllerTest like this
And the controller definition is like this this:
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions