/
types.ts
60 lines (57 loc) · 1.79 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { ExpectedResult, ActualResult } from './common';
import { IAwsApiCall, LambdaInvokeFunctionProps } from './sdk';
/**
* Interface that allows for registering a list of assertions
* that should be performed on a construct. This is only necessary
* when writing integration tests.
*/
export interface IDeployAssert {
/**
* Query AWS using JavaScript SDK V2 API calls. This can be used to either
* trigger an action or to return a result that can then be asserted against
* an expected value
*
* @example
* declare const app: App;
* declare const integ: IntegTest;
* integ.assertions.awsApiCall('SQS', 'sendMessage', {
* QueueUrl: 'url',
* MessageBody: 'hello',
* });
* const message = integ.assertions.awsApiCall('SQS', 'receiveMessage', {
* QueueUrl: 'url',
* });
* message.expect(ExpectedResult.objectLike({
* Messages: [{ Body: 'hello' }],
* }));
*/
awsApiCall(service: string, api: string, parameters?: any): IAwsApiCall;
/**
* Invoke a lambda function and return the response which can be asserted
*
* @example
* declare const app: App;
* declare const integ: IntegTest;
* const invoke = integ.assertions.invokeFunction({
* functionName: 'my-function',
* });
* invoke.expect(ExpectedResult.objectLike({
* Payload: '200',
* }));
*/
invokeFunction(props: LambdaInvokeFunctionProps): IAwsApiCall;
/**
* Assert that the ExpectedResult is equal
* to the ActualResult
*
* @example
* declare const integ: IntegTest;
* declare const apiCall: AwsApiCall;
* integ.assertions.expect(
* 'invoke',
* ExpectedResult.objectLike({ Payload: 'OK' }),
* ActualResult.fromAwsApiCall(apiCall, 'Body'),
* );
*/
expect(id: string, expected: ExpectedResult, actual: ActualResult): void;
}