Hi! This seems to be a fantastic project.
Currently I'm trying to test chrome.storage.local.get and chrome.storage.local.set, but I'm struggling to have my typscript environment, more specifically ts-jest understand that mockClear actually exists as per:
beforeEach(() => {
chrome.storage.local.get.mockClear(); // Property 'mockClear' does not exist on type ... ...
});
I've managed to setup a similar project called jest-fetch-mock, and if I dig into their source, I can see that they have types such as:
export interface FetchMock
extends jest.MockInstance<Promise<Response>, [string | Request | undefined, RequestInit | undefined]> {
(input?: string | Request, init?: RequestInit): Promise<Response>;
// Response mocking
mockResponse(fn: MockResponseInitFunction): FetchMock;
mockResponse(response: string, responseInit?: MockParams): FetchMock;
...
}
defined in their project. And I can't seem to find something similar in this project.
Could it be that my project doesn't understand that the implementations has actually created functions such as mockClear? Perhaps this project doesn't support typescript testing? If so, maybe I could declare something for the functions I'm using. I just want to make sure I'm not misunderstanding something that you've documented somewhere.
Thanks in advance!
Hi! This seems to be a fantastic project.
Currently I'm trying to test
chrome.storage.local.getandchrome.storage.local.set, but I'm struggling to have my typscript environment, more specificallyts-jestunderstand thatmockClearactually exists as per:I've managed to setup a similar project called jest-fetch-mock, and if I dig into their source, I can see that they have types such as:
defined in their project. And I can't seem to find something similar in this project.
Could it be that my project doesn't understand that the implementations has actually created functions such as
mockClear? Perhaps this project doesn't support typescript testing? If so, maybe I coulddeclaresomething for the functions I'm using. I just want to make sure I'm not misunderstanding something that you've documented somewhere.Thanks in advance!