Skip to content

Commit

Permalink
Release 1.10.1 (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
henriqueleite42 authored Sep 16, 2022
1 parent 22a4980 commit f092788
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 4 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed

## [1.10.1] - 2022-07-16

### Added

### Changed

### Fixed

- Fix `isCpf`

### Removed

## [1.10.0] - 2021-12-28

### Added
Expand Down
6 changes: 3 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ module.exports = {
resetMocks: true,
coverageThreshold: {
global: {
statements: 99.2,
branches: 97.6,
statements: 99,
branches: 97,
functions: 100,
lines: 99.7,
lines: 99,
},
},
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@techmmunity/utils",
"version": "1.10.0",
"version": "1.10.1",
"main": "index.js",
"types": "index.d.ts",
"license": "Apache-2.0",
Expand Down
1 change: 1 addition & 0 deletions src/lib/is-cpf/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const isCpf = (cpf: string) => {
if (getTypeof(cpf) !== "string") return false;

if (cpf === "") return false;
if (!/^\d{11}$/.test(cpf)) return false;

let temp: string;
let count: number;
Expand Down
12 changes: 12 additions & 0 deletions src/tests/is-cpf.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ describe("isCpf (return True)", () => {
it("with valid cpf (5)", () => {
expect(isCpf("88541113094")).toBe(true);
});

it("with valid cpf (6)", () => {
expect(isCpf("32876487306")).toBe(true);
});

it("with valid cpf (7)", () => {
expect(isCpf("11886446458")).toBe(true);
});
});

/**
Expand All @@ -39,6 +47,10 @@ describe("isCpf (return False)", () => {
expect(isCpf("")).toBe(false);
});

it("with extra words", () => {
expect(isCpf("55357314047 CPF")).toBe(false);
});

it("with masked cpf", () => {
expect(isCpf("553.573.140-47")).toBe(false);
});
Expand Down

0 comments on commit f092788

Please sign in to comment.