Sha256: ba3e5cc1fadf12e82236a76c94db468a836f5e34405ca69af50e88141124bfcf

Contents?: true

Size: 1.27 KB

Versions: 8

Compression:

Stored size: 1.27 KB

Contents

import { testComponentSnapshotsWithFixtures } from '@theforeman/test';

import {
  propsFactory,
  webhooks,
} from '../../../__tests__/WebhooksIndexPage.fixtures';
import WrappedWebhooksTable from '../index';

const props = {
  fetchAndPush: jest.fn(),
  onDeleteClick: jest.fn(),
  setToDelete: jest.fn(),
  setToEdit: jest.fn(),
  reloadWithSearch: jest.fn(),
  itemCount: 0,
  canCreate: true,
  results: [],
  pagination: {
    page: 1,
    perPage: 20,
  },
  toDelete: {},
  toEdit: 0,
};

const fixtures = {
  'should render when loading': propsFactory({
    ...props,
    isLoading: true,
    hasData: false,
    hasError: false,
  }),
  'should render with no data': propsFactory({
    ...props,
    isLoading: false,
    hasData: false,
    hasError: false,
  }),
  'should render with error': propsFactory({
    isLoading: false,
    hasData: false,
    hasError: true,
    message: {
      type: 'error',
      text: 'this is error',
    },
    ...props,
  }),
  'should render with webhooks': propsFactory({
    ...props,
    isLoading: false,
    hasError: false,
    hasData: true,
    results: webhooks,
    itemCount: webhooks.length,
  }),
};

describe('WebhooksTable', () => {
  describe('rendering', () =>
    testComponentSnapshotsWithFixtures(WrappedWebhooksTable, fixtures));
});

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
foreman_webhooks-3.1.1 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/__tests__/WebhooksTable.test.js
foreman_webhooks-3.1.0 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/__tests__/WebhooksTable.test.js
foreman_webhooks-3.0.5 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/__tests__/WebhooksTable.test.js
foreman_webhooks-3.0.4 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/__tests__/WebhooksTable.test.js
foreman_webhooks-3.0.3 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/__tests__/WebhooksTable.test.js
foreman_webhooks-3.0.2 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/__tests__/WebhooksTable.test.js
foreman_webhooks-3.0.1 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/__tests__/WebhooksTable.test.js
foreman_webhooks-3.0.0 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/__tests__/WebhooksTable.test.js