-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathepicTests.test.ts
More file actions
39 lines (34 loc) · 1.29 KB
/
epicTests.test.ts
File metadata and controls
39 lines (34 loc) · 1.29 KB
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
import type { EpicVariant } from '../../../shared/types';
import { variantHasArticleCountCopy } from './epicTests';
const baseVariant: EpicVariant = {
name: 'v1',
paragraphs: ['para 1', 'para 2'],
heading: 'heading',
highlightedText: 'highlightedText',
};
describe('variantHasArticleCountCopy', () => {
it('should return false if no article count', () => {
expect(variantHasArticleCountCopy(baseVariant)).toEqual(false);
});
it('should return true if article count in heading', () => {
const variant = {
...baseVariant,
heading: `You've read %%ARTICLE_COUNT%% articles`,
};
expect(variantHasArticleCountCopy(variant)).toEqual(true);
});
it('should return true if article count in highlightedText', () => {
const variant = {
...baseVariant,
highlightedText: `You've read %%ARTICLE_COUNT%% articles`,
};
expect(variantHasArticleCountCopy(variant)).toEqual(true);
});
it('should return true if article count in paragraphs', () => {
const variant = {
...baseVariant,
paragraphs: baseVariant.paragraphs.concat(`You've read %%ARTICLE_COUNT%% articles`),
};
expect(variantHasArticleCountCopy(variant)).toEqual(true);
});
});