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
breakingRecords :: [Int] -> [Int] | |
updateMinMax [maxRec,minRec,max, min] score = | |
[newMaxRec,newMinRec,newMax,newMin] | |
where | |
newMax = if score > max then score else max | |
newMin = if score < min then score else min | |
newMaxRec = if newMax > max then (maxRec + 1) else maxRec | |
newMinRec = if newMin < min then (minRec + 1) else minRec |
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
test('should update the value when onChange is called', () => { | |
act(() => { | |
nameField.onChange({ target: { value: 'nitin' } }); | |
}); | |
expect(nameField.value).toBe('nitin'); | |
}); |
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
test('should update the value when onChange is called', () => { | |
nameField.onChange({ target: { value: 'nitin' } }); | |
expect(nameField.value).toBe('nitin'); | |
}); |
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 useCustomEffect from '../useCustomEffect'; | |
import testHook from '../testHook'; | |
import sideEffect from 'sideeffect'; | |
jest.mock('sideeffect') | |
describe('useCustomEffect', () => { | |
test('should call side effect', () => { | |
testHook(useCustomEffect); | |
expect(sideEffect).toHaveBeenCalledTimes(1); |
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 { act } from 'react-dom/test-utils'; | |
import { testHook } from './testUtils'; | |
import useTextField from '../useTextField'; | |
let nameField; | |
beforeEach(() => { | |
testHook(() => { | |
nameField = useTextField('name'); | |
}); | |
}); |
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 { mount } from 'enzyme'; | |
const TestHook = ({ callback }) => { | |
callback(); | |
return null; | |
}; | |
export const testHook = (callback) => { | |
mount(<TestHook callback={callback} />); |
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, { useState } from 'react'; | |
const useTextField = name => { | |
const [value, setValue] = useState(''); | |
const onChange = event => { | |
setValue(event.target.value); | |
}; | |
return { |
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, { Component } from 'react'; | |
export default class InputDemo extends Component { | |
state = { | |
name: '', | |
}; | |
handleChange = event => { | |
this.setState({ | |
[event.target.name]: event.target.value, |
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
like = document.getElementsByClassName('recsGamepad__button--like')[0] | |
dislike = document.getElementsByClassName('recsGamepad__button--dislike')[0] | |
setInterval(() => { | |
randomNo = Math.random() | |
if (randomNo <= .50) // to like 50% of profiles, change this number to change the like/dislike ratio. | |
like.click() | |
else |
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, { Component } from 'react'; | |
import './App.css'; | |
import ResultComponent from './components/ResultComponent'; | |
import KeyPadComponent from "./components/KeyPadComponent"; | |
class App extends Component { | |
constructor(){ | |
super(); | |
this.state = { |
NewerOlder