This repository was archived by the owner on Jan 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
packages/s3-static-assets/tests Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,16 @@ const upload = (): Promise<AWS.S3.ManagedUpload.SendData[]> => {
1717} ;
1818
1919describe ( "Upload tests" , ( ) => {
20+ let consoleWarnSpy : jest . SpyInstance ;
21+
22+ beforeEach ( ( ) => {
23+ consoleWarnSpy = jest . spyOn ( console , "warn" ) . mockReturnValue ( ) ;
24+ } ) ;
25+
26+ afterEach ( ( ) => {
27+ consoleWarnSpy . mockRestore ( ) ;
28+ } ) ;
29+
2030 it ( "passes credentials to S3 client" , async ( ) => {
2131 await upload ( ) ;
2232
@@ -47,18 +57,16 @@ describe("Upload tests", () => {
4757 } ) ;
4858
4959 it ( "falls back to non accelerated client if checking for bucket acceleration throws an error" , async ( ) => {
50- const warnSpy = jest . spyOn ( console , "warn" ) . mockReturnValueOnce ( ) ;
51-
5260 mockGetBucketAccelerateConfigurationPromise . mockRejectedValueOnce (
5361 new Error ( "Unexpected error!" )
5462 ) ;
5563
5664 await upload ( ) ;
5765
58- expect ( warnSpy ) . toBeCalledWith ( expect . stringContaining ( "falling back" ) ) ;
66+ expect ( consoleWarnSpy ) . toBeCalledWith (
67+ expect . stringContaining ( "falling back" )
68+ ) ;
5969 expect ( AWS . S3 ) . toBeCalledTimes ( 1 ) ;
60-
61- warnSpy . mockRestore ( ) ;
6270 } ) ;
6371
6472 it ( "uploads any contents inside build directory specified in BUILD_ID" , async ( ) => {
You can’t perform that action at this time.
0 commit comments