I’m writing some Jest tests to test my CDKTF code and I’m finding an issue where when I try to call one of the matchers I get the following error message:
error TS2339: Property 'toHaveDataSource' does not exist on type 'JestMatchers<string>'.
33 expect(synthesized).toHaveDataSource(DataAzurermAppConfiguration);
This is what my test looks like:
it("should reference an App Configuration data source", () => {
const synthesized = Testing.synthScope((scope) => {
new AppConfig(scope, "AppConfig", environmentConfig);
});
expect(synthesized).toHaveDataSource(DataAzurermAppConfiguration);
});
I’ve confirmed that cdktf.Testing.setupJest()
is being called and I can see the matchers on expect
and expect(synthesized)
when I output them to console.log
.
Any ideas about what is wrong and how to fix it?