diff --git a/package.json b/package.json index 5d8bf83fa..bb64c89b4 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "prepare": "husky install", "commit-msg": "commitlint --config commitlint.config.cjs --edit", "pre-commit": "npm run test:lint", - "test": "npm run test:lint && npm run test:packages && test:packages:benchmark", + "test": "npm run test:lint && npm run test:packages && npm run test:packages:benchmark", "test:lint": "lint-staged", "test:lint:ci": "ts-standard", "test:unit": "cd packages/$PACKAGE && c8 npm run test:unit", diff --git a/packages/rds-signer/__benchmarks__/index.js b/packages/rds-signer/__benchmarks__/index.js index 79240b28c..8e505760b 100644 --- a/packages/rds-signer/__benchmarks__/index.js +++ b/packages/rds-signer/__benchmarks__/index.js @@ -1,8 +1,8 @@ import { Bench } from 'tinybench' +import { mock } from 'node:test' import middy from '../../core/index.js' import middleware from '../index.js' -import sinon from 'sinon' import { Signer } from '@aws-sdk/rds-signer' const bench = new Bench({ time: 1_000 }) @@ -11,12 +11,9 @@ const context = { getRemainingTimeInMillis: () => 30000 } const setupHandler = (options = {}) => { - const sandbox = sinon.createSandbox() - const mock = sandbox.stub() - Signer.prototype.getAuthToken = mock - mock - .onCall() - .yields(null, 'https://rds.amazonaws.com?X-Amz-Security-Token=token') + Signer.prototype.getAuthToken = mock.fn( + () => 'https://rds.amazonaws.com?X-Amz-Security-Token=token' + ) const baseHandler = () => {} return middy(baseHandler).use( middleware({ diff --git a/packages/secrets-manager/__tests__/index.js b/packages/secrets-manager/__tests__/index.js index 7fe5d4afb..fd777b81e 100644 --- a/packages/secrets-manager/__tests__/index.js +++ b/packages/secrets-manager/__tests__/index.js @@ -307,7 +307,7 @@ test('It should call aws-sdk if cache enabled but cached param has expired using await setTimeout(100) await handler(event, context) - equal(sendStub.callCount, 4) + equal(sendStub.callCount, 2) }) test('It should call aws-sdk if cache enabled but cached param has expired using NextRotationDate', async (t) => {