{"bugs":{"url":"https://github.com/aws/aws-cdk/issues"},"dist":{"shasum":"5aa7a813c99e3340e11c32c5960848112082410a","tarball":"https://registry.npmjs.org/@aws-cdk/assert/-/assert-1.203.0.tgz","fileCount":38,"integrity":"sha512-fr1ce67W9yOu7wnFfuV3iS4eWR4OriGO3tX1fYEij8zlL1RtO8lntMP3Wuf/Lo9GE0ovksSBoVWaBpK3C+6Hgg==","signatures":[{"sig":"MEYCIQCI/pdP/hubx4rjsfR1qTtOcpgQU0EWTfjlV+yhIHXbUQIhALquMGItpaQWDsYj5xlORCHRdPIxV8c6nTkaLU1K3WRQ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":183977},"main":"lib/index.js","name":"@aws-cdk/assert","_from":"file:/codebuild/output/src695992093/src/js/aws-cdk-assert-1.203.0.tgz","nozem":false,"types":"lib/index.d.ts","author":{"url":"https://aws.amazon.com","name":"Amazon Web Services"},"readme":"# Testing utilities and assertions for CDK libraries\n<!--BEGIN STABILITY BANNER-->\n\n---\n\n![Deprecated](https://img.shields.io/badge/deprecated-critical.svg?style=for-the-badge)\n\n > This API may emit warnings. Backward compatibility is not guaranteed.\n\n## Replacement recommended\n\nThis library has been deprecated. We recommend you use the\n[@aws-cdk/assertions](https://docs.aws.amazon.com/cdk/api/v1/docs/assertions-readme.html) module instead.\n\n---\n\n<!--END STABILITY BANNER-->\n\nThis library contains helpers for writing unit tests and integration tests for CDK libraries\n\n## Unit tests\n\nWrite your unit tests like this:\n\n```ts\nconst stack = new Stack();\n\nnew MyConstruct(stack, 'MyConstruct', {\n    ...\n});\n\nexpect(stack).to(someExpectation(...));\n```\n\nHere are the expectations you can use:\n\n## Verify (parts of) a template\n\nCheck that the synthesized stack template looks like the given template, or is a superset of it. These functions match logical IDs and all properties of a resource.\n\n```ts\nmatchTemplate(template, matchStyle)\nexactlyMatchTemplate(template)\nbeASupersetOfTemplate(template)\n```\n\nExample:\n\n```ts\nexpect(stack).to(beASupersetOfTemplate({\n    Resources: {\n        HostedZone674DD2B7: {\n            Type: \"AWS::Route53::HostedZone\",\n            Properties: {\n                Name: \"test.private.\",\n                VPCs: [{\n                    VPCId: { Ref: 'VPC06C5F037' },\n                    VPCRegion: { Ref: 'AWS::Region' }\n                }]\n            }\n        }\n    }\n}));\n```\n\n\n## Check existence of a resource\n\nIf you only care that a resource of a particular type exists (regardless of its logical identifier), and that *some* of its properties are set to specific values:\n\n```ts\nhaveResource(type, subsetOfProperties)\nhaveResourceLike(type, subsetOfProperties)\n```\n\nExample:\n\n```ts\nexpect(stack).to(haveResource('AWS::CertificateManager::Certificate', {\n    DomainName: 'test.example.com',\n    // Note: some properties omitted here\n\n    ShouldNotExist: ABSENT\n}));\n```\n\nThe object you give to `haveResource`/`haveResourceLike` like can contain the\nfollowing values:\n\n- **Literal values**: the given property in the resource must match the given value *exactly*.\n- `ABSENT`: a magic value to assert that a particular key in an object is *not* set (or set to `undefined`).\n- special matchers for inexact matching. You can use these to match values based on more lenient conditions\n  than the default (such as an array containing at least one element, ignoring the rest, or an inexact string\n  match).\n\nThe following matchers exist:\n\n- `objectLike(O)` - the value has to be an object matching at least the keys in `O` (but may contain\n  more). The nested values must match exactly.\n- `deepObjectLike(O)` - as `objectLike`, but nested objects are also treated as partial specifications.\n- `exactValue(X)` - must match exactly the given value. Use this to escape from `deepObjectLike`'s leniency\n  back to exact value matching.\n- `arrayWith(E, [F, ...])` - value must be an array containing the given elements (or matchers) in any order.\n- `stringLike(S)` - value must be a string matching `S`. `S` may contain `*` as wildcard to match any number\n  of characters. Multiline strings are supported.\n- `anything()` - matches any value.\n- `notMatching(M)` - any value that does NOT match the given matcher (or exact value) given.\n- `encodedJson(M)` - value must be a string which, when decoded as JSON, matches the given matcher or\n  exact value.\n\nSlightly more complex example with array matchers:\n\n```ts\nexpect(stack).to(haveResourceLike('AWS::IAM::Policy', {\n  PolicyDocument: {\n    Statement: arrayWith(objectLike({\n      Action: ['s3:GetObject'],\n      Resource: ['arn:my:arn'],\n    }})\n  }\n}));\n```\n\n## Capturing values from a match\n\nSpecial `Capture` matchers exist to capture values encountered during a match. These can be\nused for two typical purposes:\n\n- Apply additional assertions to the values found during a matching operation.\n- Use the value found during a matching operation in a new matching operation.\n\n`Capture` matchers take an inner matcher as an argument, and will only capture the value\nif the inner matcher succeeds in matching the given value.\n\nHere's an example which asserts that a policy for `RoleA` contains two statements\nwith *different* ARNs (without caring what those ARNs might be), and that\na policy for `RoleB` *also* has a statement for one of those ARNs (again, without\ncaring what the ARN might be):\n\n```ts\nconst arn1 = Capture.aString();\nconst arn2 = Capture.aString();\n\nexpect(stack).to(haveResourceLike('AWS::IAM::Policy', {\n  Roles: ['RoleA'],\n  PolicyDocument: {\n    Statement: [\n      objectLike({\n        Resource: [arn1.capture()],\n      }),\n      objectLike({\n        Resource: [arn2.capture()],\n      }),\n    ],\n  },\n}));\n\n// Don't care about the values as long as they are not the same\nexpect(arn1.capturedValue).not.toEqual(arn2.capturedValue);\n\nexpect(stack).to(haveResourceLike('AWS::IAM::Policy', {\n  Roles: ['RoleB'],\n  PolicyDocument: {\n    Statement: [\n      objectLike({\n        // This ARN must be the same as ARN1 above.\n        Resource: [arn1.capturedValue]\n      }),\n    ],\n  },\n}));\n```\n\nNOTE: `Capture` look somewhat like *bindings* in other pattern matching\nlibraries you might be used to, but they are far simpler and very\ndeterministic. In particular, they don't do unification: if the same Capture\nis either used multiple times in the same structure expression or matches\nmultiple times, no restarting of the match is done to make them all match the\nsame value: the last value encountered by the `Capture` (as determined by the\nbehavior of the matchers around it) is stored into it and will be the one\navailable after the match has completed.\n\n## Check number of resources\n\nIf you want to assert that `n` number of resources of a particular type exist, with or without specific properties:\n\n```ts\ncountResources(type, count)\ncountResourcesLike(type, count, props)\n```\n\nExample:\n\n```ts\nexpect(stack).to(countResources('AWS::ApiGateway::Method', 3));\nexpect(stack).to(countResourcesLike('AWS::ApiGateway::Method', 1, {\n  HttpMethod: 'GET',\n  ResourceId: {\n    \"Ref\": \"MyResource01234\"\n  }\n}));\n```\n\n## Check existence of an output\n\n`haveOutput` assertion can be used to check that a stack contains specific output.\nParameters to check against can be:\n\n- `outputName`\n- `outputValue`\n- `exportName`\n\nIf `outputValue` is provided, at least one of `outputName`, `exportName` should be provided as well\n\nExample\n\n```ts\nexpect(synthStack).to(haveOutput({\n  outputName: 'TestOutputName',\n  exportName: 'TestOutputExportName',\n  outputValue: {\n    'Fn::GetAtt': [\n      'TestResource',\n      'Arn'\n    ]\n  }\n}));\n```\n","engines":{"node":">= 14.15.0"},"license":"Apache-2.0","scripts":{"lint":"cdk-lint","test":"cdk-test","build":"cdk-build","watch":"cdk-watch","package":"cdk-package","pkglint":"pkglint -f","build+test":"yarn build && yarn test","build+extract":"yarn build","build+test+extract":"yarn build+test","build+test+package":"yarn build+test && yarn package"},"ubergen":{"exclude":true},"_npmUser":{"name":"aws-cdk-team","email":"aws-cdk-dev@amazon.com"},"homepage":"https://github.com/aws/aws-cdk","keywords":["aws","cdk"],"maturity":"deprecated","_resolved":"/codebuild/output/src695992093/src/js/aws-cdk-assert-1.203.0.tgz","cdk-build":{"pre":["./clone.sh"],"eslint":{"disable":true},"pkglint":{"disable":true}},"stability":"deprecated","_integrity":"sha512-fr1ce67W9yOu7wnFfuV3iS4eWR4OriGO3tX1fYEij8zlL1RtO8lntMP3Wuf/Lo9GE0ovksSBoVWaBpK3C+6Hgg==","repository":{"url":"git+https://github.com/aws/aws-cdk.git","type":"git","directory":"packages/@aws-cdk/assert"},"_npmVersion":"8.19.4","description":"An assertion library for use with CDK Apps","directories":{},"maintainers":[{"name":"romainmuller","email":"romain.muller@telecomnancy.net"},{"name":"amzn-oss","email":"osa-3p@amazon.com"},{"name":"rix0rrr","email":"rix0rrr@gmail.com"},{"name":"aws-cdk-team","email":"aws-cdk-dev@amazon.com"}],"_nodeVersion":"16.20.0","dependencies":{"constructs":"^3.3.69","@aws-cdk/core":"1.203.0","@aws-cdk/cx-api":"1.203.0","@aws-cdk/cloudformation-diff":"1.203.0"},"publishConfig":{"tag":"latest-1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^27.5.1","ts-jest":"^27.1.5","constructs":"^3.3.69","@types/jest":"^27.5.2","@aws-cdk/pkglint":"1.203.0","aws-cdk-migration":"1.203.0","@aws-cdk/assert-internal":"1.203.0","@aws-cdk/cdk-build-tools":"1.203.0"},"peerDependencies":{"jest":">=26.6.3","constructs":"^3.3.69","@aws-cdk/core":"1.203.0"},"_npmOperationalInternal":{"tmp":"tmp/assert_1.203.0_1685573543635_0.6989766549340286","host":"s3://npm-registry-packages"},"_id":"@aws-cdk/assert@1.203.0","version":"1.203.0"}