-
Notifications
You must be signed in to change notification settings - Fork 7
/
spec.jsx
40 lines (35 loc) · 980 Bytes
/
spec.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import React from 'react';
import { mount } from 'enzyme';
import { i18n } from '@shopgate/engage/core';
import I18n from '../../index';
jest.unmock('@shopgate/engage/core/helpers/i18n');
describe('<Placeholder />', () => {
const locales = {
greeting: 'Hello {world}',
};
const lang = 'en-US';
i18n.init({
locales,
lang,
});
describe('Given the component was mounted to the DOM', () => {
let renderedElement;
it('should render', () => {
renderedElement = mount((
<I18n.Provider>
<I18n.Text string="greeting">
<I18n.Placeholder forKey="world">
<strong>WORLD</strong>
</I18n.Placeholder>
/
</I18n.Text>
</I18n.Provider>
));
expect(renderedElement).toMatchSnapshot();
});
it('should render with a placeholder text', () => {
const text = renderedElement.find('strong').text();
expect(text).toBe('WORLD');
});
});
});