Skip to content

Commit

Permalink
removed unused constants
Browse files Browse the repository at this point in the history
  • Loading branch information
AmmarHalees committed Dec 26, 2023
1 parent 31cbf91 commit 6e89049
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 38 deletions.
30 changes: 0 additions & 30 deletions src/mocks/validateField.mocks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import regex from "../regex";
import constants from "../constants.json";

const minLength = {
pass: {
Expand Down Expand Up @@ -209,7 +208,6 @@ const pattern = {
input: "c123456789",
expectedOutput: [],
},

};

const required = {
Expand Down Expand Up @@ -312,34 +310,6 @@ const custom = {
{ name: "testField", message: "Name should not end with *" },
],
},

hasAtLeast3SpecialCharacters: {
rules: {
custom: {
criterion: (criterion: string) => {
const specialCharacters = constants.specialCharacters;
let count = 0;
for (let i = 0; i < criterion.length; i++) {
if (specialCharacters.includes(criterion[i] as string)) {
count++;
}
}
if (count >= 3) {
return false;
}
return true;
},
message: "Name should have at least 3 special characters",
},
},
input: "ammar*",
expectedOutput: [
{
name: "testField",
message: "Name should have at least 3 special characters",
},
],
},
};

const multipleRules = {
Expand Down
8 changes: 0 additions & 8 deletions src/tests/validateField.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,6 @@ describe("validateField", () => {
mocks.custom.noStarAtTheEnd.rules
)
).toEqual(mocks.custom.noStarAtTheEnd.expectedOutput);

expect(
validateField(
mocks.custom.hasAtLeast3SpecialCharacters.input,
"testField",
mocks.custom.hasAtLeast3SpecialCharacters.rules
)
).toEqual(mocks.custom.hasAtLeast3SpecialCharacters.expectedOutput);
});

it("should validate multiple rules", () => {
Expand Down

0 comments on commit 6e89049

Please sign in to comment.