Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Chai plugin #4

Open
szikszail opened this issue Sep 2, 2022 · 0 comments
Open

Add Chai plugin #4

szikszail opened this issue Sep 2, 2022 · 0 comments
Labels
enhancement New feature or request hacktoberfest

Comments

@szikszail
Copy link
Member

szikszail commented Sep 2, 2022

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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant