Open ghost opened 3 years ago
I found a way with importmap and sinon to mock out a dependency.
sinon
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.
mock
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
Sinon
expect
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)
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 themock
to behave how I want it.The
mock
that comes from expect seems to lack a similar feature.Sinon
not seem to "play" with theexpect
. So can not do(yes did thi same post on tincan since I'm in doubt about where to start the discussion)