expect
expect copied to clipboard
modify the `mock` after it has been declared
I found a way with importmap and sinon to mock out a dependency.
https://stackoverflow.com/questions/69677679/deno-mock-out-named-import-in-unit-test/69682382#69682382
The great think about sinon is that I can modify the mock to behave how I want it.
beforeEach(() => {
readJsonSync.withArgs(`./data.json`).returns(["hello"])
})
The mock that comes from expect seems to lack a similar feature.
Sinon not seem to "play" with the expect. So can not do
expect(writeJsonSync).toHaveBeenCalledWith('./data.json', ["hello world"])
(yes did thi same post on tincan since I'm in doubt about where to start the discussion)