mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
31 lines
931 B
TypeScript
31 lines
931 B
TypeScript
import {render, screen} from 'sentry-test/reactTestingLibrary';
|
|
|
|
import FeatureBadge from 'sentry/components/featureBadge';
|
|
|
|
describe('FeatureBadge', function () {
|
|
it('auto-hides when expired', function () {
|
|
const {rerender} = render(
|
|
<FeatureBadge
|
|
type="new"
|
|
title="Something awesome"
|
|
expiresAt={new Date(2018, 9, 16)}
|
|
/>
|
|
);
|
|
expect(screen.getByText('new')).toBeInTheDocument();
|
|
rerender(
|
|
<FeatureBadge
|
|
type="new"
|
|
title="Something awesome"
|
|
expiresAt={new Date(2017, 9, 16)}
|
|
/>
|
|
);
|
|
expect(screen.queryByText('new')).not.toBeInTheDocument();
|
|
});
|
|
it('shows before expiry date', function () {
|
|
// One hour from 'now'.
|
|
const expires = new Date(Date.now() + 1000 * 60 * 60);
|
|
render(<FeatureBadge type="new" title="Something awesome" expiresAt={expires} />);
|
|
expect(screen.getByText('new')).toBeInTheDocument();
|
|
});
|
|
});
|