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

Introduce custom Jest test matcher for matching collected entities against a well-defined schema #263

Closed
austinkelleher opened this issue Aug 2, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@austinkelleher
Copy link
Contributor

expect(context.jobState.collectedEntities).toMatchGraphObjectSchema({
  _class: ['Service'],
  schema: {
    additionalProperties: false,
    properties: {
      _type: { const: 'google_cloud_api_service' },
      category: { const: ['infrastructure'] },
      state: {
        type: 'string',
        enum: ['STATE_UNSPECIFIED', 'DISABLED', 'ENABLED'],
      },
      enabled: { type: 'boolean' },
      usageRequirements: {
        type: 'array',
        items: { type: 'string' },
      },
      _rawData: {
        type: 'array',
        items: { type: 'object' },
      }
   }
});
@austinkelleher austinkelleher added the enhancement New feature or request label Aug 2, 2020
@austinkelleher austinkelleher self-assigned this Aug 2, 2020
@aiwilliams
Copy link
Contributor

Ah, sweet, glad to see the _class isn't repeated in the schema.properties 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants