> **Experimental**
>
> `@aws-cdk/integ-tests-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# ExpectedResult

Represents the "expected" results to compare.

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/assertions/common.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0-alpha.0/packages/@aws-cdk/integ-tests-alpha/lib/assertions/common.ts#L35)

## Example

```ts
declare const app: App;
declare const stack: Stack;
declare const sm: IStateMachine;

const testCase = new IntegTest(app, 'IntegTest', {
  testCases: [stack],
});

// Start an execution
const start = testCase.assertions.awsApiCall('StepFunctions', 'startExecution', {
  stateMachineArn: sm.stateMachineArn,
});

// describe the results of the execution
const describe = testCase.assertions.awsApiCall('StepFunctions', 'describeExecution', {
  executionArn: start.getAttString('executionArn'),
});

// assert the results
describe.expect(ExpectedResult.objectLike({
  status: 'SUCCEEDED',
}));
```

## Initializer

```ts
new ExpectedResult()
```

## Properties

- `result`: string — The expected results encoded as a string.

## Methods

- `arrayWith(expected: any[]): ExpectedResult // chainable` (static) — The actual results must be a list and must contain an item with the expected results.

  ```ts
  // actual results
  const actual = [
    {
      stringParam: 'hello',
    },
    {
      stringParam: 'world',
    },
  ];
  // pass
  ExpectedResult.arrayWith([
    {
      stringParam: 'hello',
    },
  ]);
  ```

- `exact(expected: any): ExpectedResult // chainable` (static) — The actual results must match exactly.

  Missing data
  will result in a failure

  ```ts
  // actual results
  const actual = {
    stringParam: 'hello',
    numberParam: 3,
    booleanParam: true,
  };
  // pass
  ExpectedResult.exact({
    stringParam: 'hello',
    numberParam: 3,
    booleanParam: true,
  })

  // fail
  ExpectedResult.exact({
    stringParam: 'hello',
  });
  ```

- `objectLike(expected: { [key: string]: any }): ExpectedResult // chainable` (static) — The expected results must be a subset of the actual results.

  ```ts
  // actual results
  const actual = {
    stringParam: 'hello',
    numberParam: 3,
    booleanParam: true,
    objectParam: { prop1: 'value', prop2: 'value' },
  };
  // pass
  ExpectedResult.objectLike({
    stringParam: 'hello',
    objectParam: { prop1: 'value' },
  });
  ```

- `stringLikeRegexp(expected: string): ExpectedResult // chainable` (static) — Actual results is a string that matches the Expected result regex.

  ```ts
  // actual results
  const actual = 'some string value';

  // pass
  ExpectedResult.stringLikeRegexp('value');
  ```
