This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | https://jobs.libertymutualgroup.com/job/15004144/senior-software-engineer-remote/ | |
| https://jobs.libertymutualgroup.com/job/14669200/senior-software-engineer-remote-remote/ | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | export const pipe = (...fns: any) => fns.reduceRight((f: any, g: any) => (...args: any[]) => f(g(...args))); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | cy.request({ | |
| url: loginUrl, | |
| method: 'POST', | |
| form: true, | |
| body: { | |
| USER: 'username', | |
| PASSWORD: 'pw', | |
| }, | |
| }) | |
| .its('allRequestResponses') | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import React from 'react'; | |
| import LocalLoginForm from './index'; | |
| import { mount } from 'enzyme'; | |
| import { axe, toHaveNoViolations } from 'jest-axe'; | |
| import { | |
| noUserValidationMessage, | |
| noPasswordValidationMessage, | |
| noPolicyNumberValidationMessage, | |
| } from './constants'; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import axios from 'axios'; | |
| import { loginFailedDeterminantText } from './constants'; | |
| import { | |
| loginFailedMockResponse, | |
| loginSuccessMockResponse, | |
| } from './__mocks__/loginUtilMocks'; | |
| import { loginRequest, validateLoginRequest } from './utils'; | |
| jest.mock('axios'); | |
| const mockAxios = axios as jest.Mocked<typeof axios>; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | describe('Test Local Login Utils', async () => { | |
| it("Sending both valid or invalid request to auth endpoint should resolve in a 200 OK response with HTML response data", async () => { | |
| const invalidLoginResponse = await loginRequest(username, 'Incorrect Password'); | |
| const validLoginResponse = await loginRequest(username, password); | |
| expect(invalidLoginResponse).toHaveProperty('status'); | |
| expect(validLoginResponse).toHaveProperty('status'); | |
| expect(invalidLoginResponse).toHaveProperty('data'); | |
| expect(validLoginResponse).toHaveProperty('data'); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // Custom Errors | |
| class NetworkError extends Error { | |
| constructor({ message, url }) { | |
| super(message); | |
| this.name = 'NetworkError'; | |
| this.url = url; | |
| } | |
| } | |
| class APIError extends Error { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /* | |
| Attach any data that you want to your custom errors! | |
| This is similar to when we attached arbitrary properties to the standard JS error. | |
| */ | |
| class NetworkError extends Error { | |
| constructor({ message, url }) { | |
| super(message); | |
| this.name = 'NetworkError'; | |
| this.url = url; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // Helper for JSON & Plain-Text mixed responses | |
| function processResponseText(responseText) { | |
| try { | |
| return JSON.parse(responseText); | |
| } | |
| catch(err) { | |
| return responseText; | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function processResponseText(responseText) { | |
| try { | |
| return JSON.parse(responseText); | |
| } | |
| catch(err) { | |
| return responseText; | |
| } | |
| } | |
| // This will throw an error. | 
NewerOlder