You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm excited about using this library, and I'm suspecting it's some configuration that's causing me headaches. But I have a 3rd party library (airtable) that I am trying to stub for testing purposes. Below is my simplified code:
import { ImportMock } from "ts-mock-imports";
import Airtable from "airtable";
const airtableMock = ImportMock.mockClass(Airtable, "Airtable");
const stub = airtableMock.mock("destroy");
I keep getting the following errors for the mockClass and the mock functions:
error TS2345: Argument of type '"Airtable"' is not assignable to parameter of type '"prototype" | "Base" | "Record" | "Table" | "Error" | "apiKey" | "apiVersion" | "endpointUrl" | "noRetryIfRateLimited" | "requestTimeout" | "default_config" | "configure" | "base" | undefined'.
8 const airtableMock = ImportMock.mockClass(Airtable, "Airtable");
error TS2345: Argument of type '"destroy"' is not assignable to parameter of type '"prototype" | "Base" | "Record" | "Table" | "Error" | "apiKey" | "apiVersion" | "endpointUrl" | "noRetryIfRateLimited" | "requestTimeout" | "default_config" | "configure" | "base" | undefined'.
8 ImportMock.mockFunction(Airtable, "destroy");
The text was updated successfully, but these errors were encountered:
Closing as I realized it was a problem in the way I was trying to mock the class/function. Didn't understand the process well enough. After reading through the docs and source code, I think I'm on the right track.
I'm excited about using this library, and I'm suspecting it's some configuration that's causing me headaches. But I have a 3rd party library (airtable) that I am trying to stub for testing purposes. Below is my simplified code:
I keep getting the following errors for the
mockClass
and themock
functions:The text was updated successfully, but these errors were encountered: