Skip to content

Commit

Permalink
[Uptime] Refactor snapshots into RTL (elastic#113727)
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 authored Oct 4, 2021
1 parent 1f60a16 commit abffa79
Show file tree
Hide file tree
Showing 24 changed files with 183 additions and 4,623 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,29 @@
*/

import React from 'react';
import { renderWithRouter, shallowWithRouter } from '../../lib';
import { FingerprintCol } from './fingerprint_col';
import moment from 'moment';
import { FingerprintCol } from './fingerprint_col';
import { render } from '../../lib/helper/rtl_helpers';

describe('FingerprintCol', () => {
const cert = {
monitors: [{ name: '', id: 'github', url: 'https://github.com/' }],
not_after: '2020-05-08T00:00:00.000Z',
not_before: '2018-05-08T00:00:00.000Z',
issuer: 'DigiCert SHA2 Extended Validation Server CA',
sha1: 'ca06f56b258b7a0d4f2b05470939478651151984',
sha256: '3111500c4a66012cdae333ec3fca1c9dde45c954440e7ee413716bff3663c074',
sha1: 'ca06f56b258b7a0d4f2b05470939478651151984'.toUpperCase(),
sha256: '3111500c4a66012cdae333ec3fca1c9dde45c954440e7ee413716bff3663c074'.toUpperCase(),
common_name: 'github.com',
};

it('shallow renders expected elements for valid props', () => {
expect(shallowWithRouter(<FingerprintCol cert={cert} />)).toMatchSnapshot();
});

it('renders expected elements for valid props', () => {
it('renders expected elements for valid props', async () => {
cert.not_after = moment().add('4', 'months').toISOString();
const { findByText, findByTestId } = render(<FingerprintCol cert={cert} />);

expect(await findByText('SHA 1')).toBeInTheDocument();
expect(await findByText('SHA 256')).toBeInTheDocument();

expect(renderWithRouter(<FingerprintCol cert={cert} />)).toMatchSnapshot();
expect(await findByTestId(cert.sha1)).toBeInTheDocument();
expect(await findByTestId(cert.sha256)).toBeInTheDocument();
});
});
Loading

0 comments on commit abffa79

Please sign in to comment.