@@ -6,6 +6,7 @@ import assert from 'node:assert';
66import {
77 CloudWatchLogsClient ,
88 FilterLogEventsCommand ,
9+ FilterLogEventsCommandInput ,
910} from '@aws-sdk/client-cloudwatch-logs' ;
1011import { printer } from '@aws-amplify/cli-core' ;
1112
@@ -17,15 +18,13 @@ void describe('LambdaFunctionLogStreamer', () => {
1718
1819 // CW default implementation, return test events for each log group
1920 const cloudWatchClientMock = new CloudWatchLogsClient ( { region } ) ;
20- const cloudWatchClientSendMock = mock . fn ( ) ;
21- mock . method ( cloudWatchClientMock , 'send' , cloudWatchClientSendMock ) ;
21+ const cloudWatchClientSendMock = mock . method ( cloudWatchClientMock , 'send' ) ;
2222
2323 let classUnderTest : CloudWatchLogEventMonitor ;
2424
2525 beforeEach ( ( ) => {
2626 classUnderTest = new CloudWatchLogEventMonitor ( cloudWatchClientMock ) ;
2727 mockedWrite . mock . resetCalls ( ) ;
28- cloudWatchClientSendMock . mock . restore ( ) ;
2928 cloudWatchClientSendMock . mock . resetCalls ( ) ;
3029 } ) ;
3130
@@ -79,7 +78,7 @@ void describe('LambdaFunctionLogStreamer', () => {
7978 } ) ;
8079
8180 void it ( 'ensures that unmask option is set to fast (default) when calling filterLogEvents API' , async ( ) => {
82- cloudWatchClientSendMock . mock . mockImplementation ( ( ) => {
81+ cloudWatchClientSendMock . mock . mockImplementationOnce ( ( ) => {
8382 return Promise . resolve ( {
8483 events : [ ] ,
8584 } ) ;
@@ -91,9 +90,9 @@ void describe('LambdaFunctionLogStreamer', () => {
9190 classUnderTest . pause ( ) ;
9291
9392 assert . strictEqual ( cloudWatchClientSendMock . mock . calls . length , 1 ) ;
94- const filterLogEventsCommand =
95- cloudWatchClientSendMock . mock . calls [ 0 ] . arguments [ 0 ] ;
96- assert . ok ( ! filterLogEventsCommand . input . unmask ) ; // unmask should be false
93+ const filterLogEventsCommand = cloudWatchClientSendMock . mock . calls [ 0 ]
94+ . arguments [ 0 ] as FilterLogEventsCommandInput ;
95+ assert . ok ( ! filterLogEventsCommand . unmask ) ; // unmask should be false
9796 } ) ;
9897
9998 void it ( 'continue to stream CW logs until deactivated' , async ( ) => {
0 commit comments