Skip to content

Commit

Permalink
include sinon.restore in more places where it might be needed
Browse files Browse the repository at this point in the history
  • Loading branch information
LiranCohen committed Aug 27, 2024
1 parent fb12451 commit d873eeb
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/credentials/tests/jwt.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import { VerifiableCredential } from '../src/verifiable-credential.js';
import sinon from 'sinon';

describe('Jwt', () => {

after(() => {
sinon.restore();
});

describe('parse()', () => {
it('throws error if JWT doesnt contain 3 parts', async () => {
expect(() =>
Expand Down
1 change: 1 addition & 0 deletions packages/credentials/tests/ssi-validator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ describe('SsiValidator', () => {

afterEach(() => {
fetchStub.restore();
sinon.restore();
});

it('should throw an error if credential schema is missing', async () => {
Expand Down
4 changes: 4 additions & 0 deletions packages/credentials/tests/verifiable-credential.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ describe('Verifiable Credential Tests', () => {
) {}
}

after(() => {
sinon.restore();
});

beforeEach(async () => {
issuerDid = await DidJwk.create();
});
Expand Down
4 changes: 4 additions & 0 deletions packages/crypto-aws-kms/tests/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import { Convert } from '@web5/common';
import { mockEcdsaSecp256k1 } from './fixtures/mock-ecdsa-secp256k1.js';

describe('AWS KMS Utils', () => {
after(() => {
sinon.restore();
});

describe('convertSpkiToPublicKey()', () => {
it('converts DER-encoded SPKI public key to JWK', () => {
// Setup.
Expand Down
4 changes: 4 additions & 0 deletions packages/crypto/tests/local-key-manager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import { LocalKeyManager } from '../src/local-key-manager.js';
describe('LocalKeyManager', () => {
let keyManager: LocalKeyManager;

after(() => {
sinon.restore();
});

beforeEach(() => {
keyManager = new LocalKeyManager();
});
Expand Down
4 changes: 4 additions & 0 deletions packages/dids/tests/bearer-did.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import { BearerDid } from '../src/bearer-did.js';
describe('BearerDid', () => {
let portableDid: PortableDid;

after(() => {
sinon.restore();
});

beforeEach(() => {
portableDid = {
uri : 'did:jwk:eyJjcnYiOiJFZDI1NTE5Iiwia3R5IjoiT0tQIiwieCI6Im80MHNoWnJzY28tQ2ZFcWs2bUZzWGZjUDk0bHkzQXozZ204NFB6QVVzWG8iLCJraWQiOiJCRHAweGltODJHc3dseG5QVjhUUHRCZFV3ODB3a0dJRjhnakZidzF4NWlRIiwiYWxnIjoiRWREU0EifQ',
Expand Down
1 change: 1 addition & 0 deletions packages/dids/tests/methods/did-dht.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ describe('DidDht', () => {

afterEach(() => {
fetchStub.restore();
sinon.restore();
});

describe('create()', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/dids/tests/methods/did-ion.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe('DidIon', () => {

afterEach(() => {
fetchStub.restore();
sinon.restore();
});

describe('create', () => {
Expand Down
4 changes: 4 additions & 0 deletions packages/dids/tests/methods/did-web.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ const fetchOkResponse = (response: any) => ({
});

describe('DidWeb', () => {
after(() => {
sinon.restore();
});

describe('resolve()', () => {
it(`returns a 'notFound' error if the HTTP GET response is not status code 200`, async () => {
// Setup stub so that a mocked response is returned rather than calling over the network.
Expand Down
1 change: 1 addition & 0 deletions packages/dids/tests/resolver/resolver-cache-level.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describe('DidResolverCacheLevel', () => {

after(() => {
clock.restore();
sinon.restore();
});

describe('constructor', () => {
Expand Down

0 comments on commit d873eeb

Please sign in to comment.