MCPcopy Create free account
hub / github.com/cameri/nostream / mock

Function mock

test/unit/tor/onion.spec.ts:36–53  ·  view source on GitHub ↗
(sandbox: Sinon.SinonSandbox, readFail?: boolean, writeFail?: boolean)

Source from the content-addressed store, hash-verified

34 }
35 let sandbox: Sinon.SinonSandbox
36 const mock = function (sandbox: Sinon.SinonSandbox, readFail?: boolean, writeFail?: boolean) {
37 sandbox.stub(fs, 'readFile').callsFake(async (path, options) => {
38 void path
39 void options
40 if (readFail) {
41 throw new Error()
42 }
43 return 'privKey'
44 })
45 sandbox.stub(fs, 'writeFile').callsFake(async (path, options) => {
46 void path
47 void options
48 if (writeFail) {
49 throw new Error()
50 }
51 return
52 })
53 }
54
55 beforeEach(() => {
56 sandbox = Sinon.createSandbox()

Callers 1

onion.spec.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected