|
1 | 1 | 'use strict'; |
2 | 2 |
|
3 | | -import React, {Component} from 'react'; |
4 | | -import { Text, View, TextInput } from 'react-native'; |
5 | | -import {shallow, mount} from 'enzyme'; |
6 | | -import Moment from 'moment'; |
7 | | -import {expect} from 'chai'; |
8 | | -import sinon from 'sinon'; |
| 3 | +import { expect } from 'chai'; |
| 4 | +import { mount, shallow } from 'enzyme'; |
| 5 | +/*---------------- mock DOM ----------------*/ |
| 6 | +import { jsdom } from 'jsdom'; |
| 7 | +import React from 'react'; |
| 8 | +import { TextInput } from 'react-native'; |
9 | 9 | import FormTest from './formTest'; |
10 | 10 |
|
11 | | -/*---------------- mock DOM ----------------*/ |
12 | | -import {jsdom} from 'jsdom'; |
13 | 11 | var exposedProperties = ['window', 'navigator', 'document']; |
14 | 12 |
|
15 | 13 | global.document = jsdom(''); |
@@ -84,17 +82,17 @@ describe('ValidationComponent:', () => { |
84 | 82 | formTest._onPressButton(); |
85 | 83 |
|
86 | 84 | expect(formTest.isFormValid()).to.equal(false); |
87 | | - expect(formTest.getErrorMessages()).to.equal('The field "name" length must be greater than 3.'); |
| 85 | + expect(formTest.getErrorMessages()).to.equal('The field "name" length must be greater than 2.'); |
88 | 86 | expect(formTest.isFieldInError('name')).to.equal(true); |
89 | 87 |
|
90 | 88 | // Seize an empty value |
91 | 89 | textInput.simulate('changeText', ""); // minlength = 3 |
92 | 90 | formTest._onPressButton(); |
93 | 91 | expect(formTest.isFormValid()).to.equal(false); |
94 | 92 | expect(formTest.getErrorMessages()).to. |
95 | | - equal('The field "name" length must be greater than 3.\nThe field "name" is mandatory.'); |
| 93 | + equal('The field "name" length must be greater than 2.\nThe field "name" is mandatory.'); |
96 | 94 | expect(formTest.getErrorsInField('name')).to.deep.equal([ |
97 | | - 'The field "name" length must be greater than 3.', |
| 95 | + 'The field "name" length must be greater than 2.', |
98 | 96 | 'The field "name" is mandatory.' |
99 | 97 | ]) |
100 | 98 | expect(formTest.isFieldInError('name')).to.equal(true); |
|
0 commit comments