Skip to content

Commit

Permalink
feat(release): v0.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
tdervilyIAD committed Oct 25, 2019
1 parent 8d2c522 commit a904b9f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-form-validator",
"version": "0.3.1",
"version": "0.3.2",
"description": "React native library to validate form fields",
"main": "index.js",
"scripts": {
Expand All @@ -25,13 +25,12 @@
"homepage": "https://github.com/perscrew/react-native-form-validator#readme",
"dependencies": {
"moment": "^2.11.2",
"prop-types" : "15.6.0"
"prop-types": "15.6.0"
},
"devDependencies": {
"react": "~15.4.0",
"react-native": "^0.42.0",
"cz-conventional-changelog": "^1.1.6",

"babel-core": "^6.5.2",
"babel-preset-react-native": "^1.8.0",
"chai": "^3.5.0",
Expand Down
20 changes: 9 additions & 11 deletions test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
'use strict';

import React, {Component} from 'react';
import { Text, View, TextInput } from 'react-native';
import {shallow, mount} from 'enzyme';
import Moment from 'moment';
import {expect} from 'chai';
import sinon from 'sinon';
import { expect } from 'chai';
import { mount, shallow } from 'enzyme';
/*---------------- mock DOM ----------------*/
import { jsdom } from 'jsdom';
import React from 'react';
import { TextInput } from 'react-native';
import FormTest from './formTest';

/*---------------- mock DOM ----------------*/
import {jsdom} from 'jsdom';
var exposedProperties = ['window', 'navigator', 'document'];

global.document = jsdom('');
Expand Down Expand Up @@ -84,17 +82,17 @@ describe('ValidationComponent:', () => {
formTest._onPressButton();

expect(formTest.isFormValid()).to.equal(false);
expect(formTest.getErrorMessages()).to.equal('The field "name" length must be greater than 3.');
expect(formTest.getErrorMessages()).to.equal('The field "name" length must be greater than 2.');
expect(formTest.isFieldInError('name')).to.equal(true);

// Seize an empty value
textInput.simulate('changeText', ""); // minlength = 3
formTest._onPressButton();
expect(formTest.isFormValid()).to.equal(false);
expect(formTest.getErrorMessages()).to.
equal('The field "name" length must be greater than 3.\nThe field "name" is mandatory.');
equal('The field "name" length must be greater than 2.\nThe field "name" is mandatory.');
expect(formTest.getErrorsInField('name')).to.deep.equal([
'The field "name" length must be greater than 3.',
'The field "name" length must be greater than 2.',
'The field "name" is mandatory.'
])
expect(formTest.isFieldInError('name')).to.equal(true);
Expand Down

0 comments on commit a904b9f

Please sign in to comment.