Skip to content

Commit

Permalink
Format code with Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 9, 2024
1 parent 0a3abbf commit 4a49583
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 19 deletions.
3 changes: 2 additions & 1 deletion web/__test__/utils/form-validator/ValidateAll.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ describe("Validate Text", () => {

it("should return false with answers not valid", () => {
const name = "gury";
const answer = "answeransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweranswer";
const answer =
"answeransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweransweranswer";
const email = "[email protected]";
const phoneNumber = "123456789123";
const output = FormValidate.validateAll(name, email, phoneNumber, [
Expand Down
3 changes: 2 additions & 1 deletion web/__test__/utils/form-validator/ValidateEmail.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ describe("Validate Email", () => {
});

it("should return false without an large string", () => {
const email = "1234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345@gmail.com";
const email =
"1234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345@gmail.com";
const output = FormValidate.validateEmail(email);
const expected = false;
expect(output).toEqual(expected);
Expand Down
3 changes: 2 additions & 1 deletion web/__test__/utils/form-validator/ValidateName.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ describe("Validate Name", () => {
});

it("should return false without an large string", () => {
const name = "1234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345@gmail.com";
const name =
"1234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345@gmail.com";
const output = FormValidate.validateName(name);
const expected = false;
expect(output).toEqual(expected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ describe("Validate Phone Number", () => {
});

it("should return false without a large number", () => {
const phoneNumber = "1234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345@gmail.com";
const phoneNumber =
"1234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345@gmail.com";
const output = FormValidate.validatePhoneNumber(phoneNumber);
const expected = false;
expect(output).toEqual(expected);
Expand Down
22 changes: 7 additions & 15 deletions web/src/utils/FormValidate.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
export class FormValidate {
static validateEmail(text: string) : boolean {
const regex = (text
static validateEmail(text: string): boolean {
const regex = text
.toLowerCase()
.match(
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
))
return (
text.length > 2 &&
text.length < 99 &&
(regex !== null)
);
);
return text.length > 2 && text.length < 99 && regex !== null;
}

static validateName(text: string) {
Expand All @@ -34,13 +30,9 @@ export class FormValidate {

static validatePhoneNumber(text: string) {
const regex = text
.toLowerCase()
.match(/^(([0-9\ \+\_\-\,\.\^\*\?\$\^\#\(\)])|(ext|x)){1,20}$/)
return (
text.length > 6 &&
text.length < 20 &&
(regex !== null)
);
.toLowerCase()
.match(/^(([0-9\ \+\_\-\,\.\^\*\?\$\^\#\(\)])|(ext|x)){1,20}$/);
return text.length > 6 && text.length < 20 && regex !== null;
}

static validateAnswers(
Expand Down

0 comments on commit 4a49583

Please sign in to comment.