import React from 'react'; import renderer from 'react-test-renderer'; import moment from 'moment'; import { notificationGroup1, notificationGroup2 } from './docz'; import { Notification } from './Notification'; import { TranslationProvider } from '../context/TranslationContext'; // @ts-expect-error Date.now = jest.fn(() => new Date('2021-04-15T11:34:36.104Z')); const translationProviderData = { t: String, tDateTimeParser: moment }; describe('Notification', () => { it('renders with test data (notificationGroup1)', () => { const tree = renderer .create( , ) .toJSON(); expect(tree).toMatchInlineSnapshot(`
{{ actorName }} liked your {{ activityVerb }}
2 days ago
`); }); it('renders with test data (notificationGroup2)', () => { const tree = renderer .create( , ) .toJSON(); expect(tree).toMatchInlineSnapshot(`
{{ actorName }} and {{ countOtherActors }} others followed you
4 days ago
`); }); });