Skip to content

Add Chai plugin #4

@szikszail

Description

@szikszail

Add chai plugin for the tool and add properties and methods.

Examples:

// stack.test.ts
import * as cdk from 'aws-cdk-lib';
import * as MyStack from '../lib/mystack.ts';
import { chaiPlugin } from 'aws-cdk-assert';
import { use } from 'chai';
use(chaiPlugin);

describe('MyStack', () => {
  let stack: MyStack.Mystack;

  beforeAll(() => {
    const app = new cdk.App();
    stack = new MyStack.MyStack(app, 'MyStack', {
      // props
    });
  });

  test('should have S3 Bucket', () => {
    expect(stack).to.have.s3Bucket({ bucketName: 'MyBucket' });
  });
});

Options:

  1. Single method per resource type with properties object for simple properties:
    expect(stack).to.have.s3Bucket({ bucketName: 'MyBucket' });
  2. Resource properties and methods per each simple property (same as the resource methods):
    expect(stack).with.s3Bucket.withBucketName('MyBucket').exists;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions