We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
The test case is failing because it hardcodes a fixed date ("2025-04-12"). This is not a best practice.
describe("Input fields functionality",()=>{it("should display no error for name input field's if criteria is met",()=>{changeInputFields("UserA","user-email.com",123,"2025-04-12");expect(inputName.children).toHaveLength(1);expect(inputEmail.children).toHaveLength(2);expect(inputEmployeeId.children).toHaveLength(2);expect(inputJoiningDate.children).toHaveLength(2);expect(inputEmail.children[1]).toHaveTextContent("Email must be a valid email address");expect(inputEmployeeId.children[1]).toHaveTextContent("Employee ID must be exactly 6 digits");expect(inputJoiningDate.children[1]).toHaveTextContent("Joining Date cannot be in the future");});it("should display no error for email input field's if criteria is met",()=>{changeInputFields("UserA","user@email.com",123,"2025-04-12");expect(inputName.children).toHaveLength(1);expect(inputEmail.children).toHaveLength(1);expect(inputEmployeeId.children).toHaveLength(2);expect(inputJoiningDate.children).toHaveLength(2);expect(inputEmployeeId.children[1]).toHaveTextContent("Employee ID must be exactly 6 digits");expect(inputJoiningDate.children[1]).toHaveTextContent("Joining Date cannot be in the future");});it("should display no error for employee ID input field's if criteria is met",()=>{changeInputFields("Use","user@email.com",123456,"2025-04-12");expect(inputName.children).toHaveLength(2);expect(inputEmail.children).toHaveLength(1);expect(inputEmployeeId.children).toHaveLength(1);expect(inputJoiningDate.children).toHaveLength(2);expect(inputName.children[1]).toHaveTextContent("Name must be at least 4 characters long and only contain letters and spaces");});expect(inputJoiningDate.children[1]).toHaveTextContent("Joining Date cannot be in the future");});
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Employee Validation
You are viewing a single comment's thread. Return to all comments →
The test case is failing because it hardcodes a fixed date ("2025-04-12"). This is not a best practice.