diff --git a/packages/peer-id/package.json b/packages/peer-id/package.json index 7229d75107..53dedf850b 100644 --- a/packages/peer-id/package.json +++ b/packages/peer-id/package.json @@ -60,7 +60,8 @@ "uint8arrays": "^5.1.0" }, "devDependencies": { - "aegir": "^44.0.1" + "aegir": "^44.0.1", + "sinon": "^19.0.2" }, "sideEffects": false } diff --git a/packages/peer-id/test/index.spec.ts b/packages/peer-id/test/index.spec.ts index 469eac7a99..b94506fbfd 100644 --- a/packages/peer-id/test/index.spec.ts +++ b/packages/peer-id/test/index.spec.ts @@ -4,6 +4,7 @@ import { expect } from 'aegir/chai' import { base58btc } from 'multiformats/bases/base58' import { CID } from 'multiformats/cid' import { identity } from 'multiformats/hashes/identity' +import Sinon from 'sinon' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { peerIdFromCID, peerIdFromMultihash, peerIdFromPrivateKey, peerIdFromString } from '../src/index.js' import type { KeyType, PeerId } from '@libp2p/interface' @@ -99,6 +100,13 @@ describe('PeerId', () => { expect(peerId1).to.deep.equal(peerId2) }) + + it('should be matched by sinon', () => { + const stub = Sinon.stub() + stub(peerId) + + expect(stub.calledWith(peerId)).to.be.true() + }) }) })