This repository was archived by the owner on Mar 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.test.js
More file actions
78 lines (61 loc) · 2.11 KB
/
index.test.js
File metadata and controls
78 lines (61 loc) · 2.11 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* @flow */
/*
import React from 'react';
import { shallow } from 'enzyme';
import MonthSelectBox from './index';
import {
MONTHS,
MONTHS_SHORT,
} from './constants';
describe('<MonthSelectBox />', () => {
let renderedMonthSelectBox;
beforeEach(() => {
renderedMonthSelectBox = shallow(<MonthSelectBox name="MONT_SELECT_BOX_NAME" />);
});
it('should render a select box', () => {
expect(renderedMonthSelectBox.is('select')).toBeTruthy();
});
it('should render options with full name of months', () => {
expectToHasOptions(renderedMonthSelectBox, MONTHS);
});
it('should render children if any provided', () => {
const CustomOption = () => <option>CUSTOM_OPTION</option>;
renderedMonthSelectBox = shallow(
<MonthSelectBox name="MONT_SELECT_BOX_NAME">
<CustomOption />
</MonthSelectBox>
);
expect(renderedMonthSelectBox.find(CustomOption).length).toBe(1);
});
});
describe('<MonthSelectBox mode="short" />', () => {
let renderedMonthSelectBox;
beforeEach(() => {
renderedMonthSelectBox = shallow(<MonthSelectBox name="MONT_SELECT_BOX_NAME" mode="short" />);
});
it('should render a select box', () => {
expect(renderedMonthSelectBox.is('select')).toBeTruthy();
});
it('should render options with short name of months', () => {
expectToHasOptions(renderedMonthSelectBox, MONTHS_SHORT);
});
});
describe('<MonthSelectBox mode="numbers" />', () => {
let renderedMonthSelectBox;
beforeEach(() => {
renderedMonthSelectBox = shallow(<MonthSelectBox name="MONT_SELECT_BOX_NAME" mode="numbers" />);
});
it('should render a select box', () => {
expect(renderedMonthSelectBox.is('select')).toBeTruthy();
});
it('should render options with numeric name of months', () => {
const months = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
expectToHasOptions(renderedMonthSelectBox, months);
});
});
function expectToHasOptions(renderedMonthSelectBox, options) {
options.forEach((value, key) => {
expect(renderedMonthSelectBox.contains(<option value={key}>{value}</option>)).toBeTruthy();
});
}
*/