@@ -4,7 +4,7 @@ import "@aws-sdk/crc64-nvme-crt";
44import { ChecksumAlgorithm , S3 } from "@aws-sdk/client-s3" ;
55import { HttpHandler , HttpRequest , HttpResponse } from "@smithy/protocol-http" ;
66import { Readable , Transform } from "stream" ;
7- import { describe , expect , test as it , vi } from "vitest" ;
7+ import { describe , expect , test as it } from "vitest" ;
88
99import { requireRequestsFrom } from "../../../private/aws-util-test/src" ;
1010import { DEFAULT_CHECKSUM_ALGORITHM , RequestChecksumCalculation , ResponseChecksumValidation } from "./constants" ;
@@ -106,10 +106,10 @@ describe("middleware-flexible-checksums", () => {
106106 const maxAttempts = 3 ;
107107 const client = new S3 ( { maxAttempts } ) ;
108108
109- const mockFlexChecksCallsFn = vi . fn ( ) ;
109+ let flexChecksCalls = 0 ;
110110 client . middlewareStack . addRelativeTo (
111111 ( next : any ) => async ( args : any ) => {
112- mockFlexChecksCallsFn ( ) ;
112+ flexChecksCalls ++ ;
113113 return next ( args ) ;
114114 } ,
115115 {
@@ -118,10 +118,10 @@ describe("middleware-flexible-checksums", () => {
118118 }
119119 ) ;
120120
121- const mockRetryMiddlewareCallsFn = vi . fn ( ) ;
121+ let retryMiddlewareCalls = 0 ;
122122 client . middlewareStack . addRelativeTo (
123123 ( next : any ) => async ( args : any ) => {
124- mockRetryMiddlewareCallsFn ( ) ;
124+ retryMiddlewareCalls ++ ;
125125 return next ( args ) ;
126126 } ,
127127 {
@@ -150,9 +150,9 @@ describe("middleware-flexible-checksums", () => {
150150 } ) ;
151151
152152 // Validate that flexibleChecksumsMiddleware is called once.
153- expect ( mockFlexChecksCallsFn ) . toHaveBeenCalledTimes ( 1 ) ;
153+ expect ( flexChecksCalls ) . toEqual ( 1 ) ;
154154 // Validate that retryMiddleware is called maxAttempts times.
155- expect ( mockRetryMiddlewareCallsFn ) . toHaveBeenCalledTimes ( maxAttempts ) ;
155+ expect ( retryMiddlewareCalls ) . toEqual ( maxAttempts ) ;
156156 } ) ;
157157 } ) ;
158158
0 commit comments