Skip to content

Commit

Permalink
chore: test coverage improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
the-darc committed May 15, 2015
1 parent bbe7941 commit 9acca86
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 40 deletions.
5 changes: 3 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ var gulp = require('gulp'),

var config = {
src: {
files: 'src/**/*.js'
files: 'src/**/*.js',
release: 'releases/br-masks.js'
},
test: {
files: 'test/**/*.test.js'
Expand Down Expand Up @@ -118,7 +119,7 @@ gulp.task('test-watch', ['jshint', 'build', 'runtest'], function() {
});

gulp.task('test-coverage', function(done) {
gulp.src(config.src.files)
gulp.src(config.src.release)
.pipe(plugins.istanbul())
.pipe(plugins.istanbul.hookRequire())
.on('finish', function() {
Expand Down
6 changes: 1 addition & 5 deletions releases/br-masks-standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
/**
* br-masks
* A library of masks applicable to several Brazilian data like I.E., CNPJ, CPF and others
* @version v0.3.4
* @version v0.4.0
* @link http://github.com/the-darc/br-masks
* @license MIT
*/
Expand Down Expand Up @@ -322,10 +322,6 @@ var IE = function(value, uf) {
};

function clearValue (value) {
if(!value) {
return value;
}

return value.replace(/[^0-9]/g, '');
}

Expand Down
2 changes: 1 addition & 1 deletion releases/br-masks-standalone.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions releases/br-masks.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* br-masks
* A library of masks applicable to several Brazilian data like I.E., CNPJ, CPF and others
* @version v0.3.4
* @version v0.4.0
* @link http://github.com/the-darc/br-masks
* @license MIT
*/
Expand Down Expand Up @@ -129,10 +129,6 @@ var IE = function(value, uf) {
};

function clearValue (value) {
if(!value) {
return value;
}

return value.replace(/[^0-9]/g, '');
}

Expand Down
2 changes: 1 addition & 1 deletion releases/br-masks.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions src/ie.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ var IE = function(value, uf) {
};

function clearValue (value) {
if(!value) {
return value;
}

return value.replace(/[^0-9]/g, '');
}

Expand Down
11 changes: 10 additions & 1 deletion test/cep.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
var should = require('should'),
BrM = require('../releases/br-masks.min');
BrM = require('../releases/br-masks');

describe('CEP', function(){
it('should not mask empty values', function(done) {
should(BrM.cep(null)).be.eql(null);
should(BrM.cep(undefined)).be.eql(undefined);
should(BrM.cep('')).be.eql('');
should(BrM.cep(0)).be.eql(0);
should(BrM.cep(false)).be.eql(false);
done();
});

it('should maks 30480530 to 30480-530', function(done) {
should(BrM.cep('30480530')).be.eql('30480-530');
done();
Expand Down
11 changes: 10 additions & 1 deletion test/cnpj.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
var should = require('should'),
BrM = require('../releases/br-masks.min');
BrM = require('../releases/br-masks');

describe('CNPJ', function(){
it('should not mask empty values', function(done) {
should(BrM.cnpj(null)).be.eql(null);
should(BrM.cnpj(undefined)).be.eql(undefined);
should(BrM.cnpj('')).be.eql('');
should(BrM.cnpj(0)).be.eql(0);
should(BrM.cnpj(false)).be.eql(false);
done();
});

it('should maks 10157471000161 to 10.157.471/0001-61', function(done) {
should(BrM.cnpj('10157471000161')).be.eql('10.157.471/0001-61');
done();
Expand Down
11 changes: 10 additions & 1 deletion test/cpf-cnpj.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
var should = require('should'),
BrM = require('../releases/br-masks.min');
BrM = require('../releases/br-masks');

describe('CPF/CNPJ', function(){
it('should not mask empty values', function(done) {
should(BrM.cpfCnpj(null)).be.eql(null);
should(BrM.cpfCnpj(undefined)).be.eql(undefined);
should(BrM.cpfCnpj('')).be.eql('');
should(BrM.cpfCnpj(0)).be.eql(0);
should(BrM.cpfCnpj(false)).be.eql(false);
done();
});

it('should maks 10157471000161 to 10.157.471/0001-61', function(done) {
should(BrM.cpfCnpj('10157471000161')).be.eql('10.157.471/0001-61');
done();
Expand Down
11 changes: 10 additions & 1 deletion test/cpf.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
var should = require('should'),
BrM = require('../releases/br-masks.min');
BrM = require('../releases/br-masks');

describe('CPF ', function() {
it('should not mask empty values', function(done) {
should(BrM.cpf(null)).be.eql(null);
should(BrM.cpf(undefined)).be.eql(undefined);
should(BrM.cpf('')).be.eql('');
should(BrM.cpf(0)).be.eql(0);
should(BrM.cpf(false)).be.eql(false);
done();
});

it('should mask 97070868669 to 970.708.686-69', function(done) {
should(BrM.cpf('97070868669')).be.eql('970.708.686-69');
done();
Expand Down
2 changes: 1 addition & 1 deletion test/finance.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var should = require('should'),
BrM = require('../releases/br-masks.min');
BrM = require('../releases/br-masks');

describe('FINANCE', function(){
it('should maks 125 to 125.00', function(done) {
Expand Down
Loading

0 comments on commit 9acca86

Please sign in to comment.