Skip to content

Commit

Permalink
test: small update
Browse files Browse the repository at this point in the history
  • Loading branch information
willfarrell committed Jul 2, 2024
1 parent 855d6d0 commit 35f5d06
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 4 additions & 7 deletions packages/rds-signer/__benchmarks__/index.js
Original file line number Diff line number Diff line change
@@ -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 })
Expand All @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion packages/secrets-manager/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 35f5d06

Please sign in to comment.