- 🔭 I'm a developer living in London, UK. I work at Credit Karma.
- 🌱 I’m currently learning Vertex AI, Python and MLOps.
- 👨💻 I’m currently working as a product engineer. You can reach me here
Socials:
import { Lens } from 'monocle-ts'; | |
import { id, prop, modify } from 'monocle-ts/Lens'; | |
import { pipe } from 'fp-ts/function'; | |
import { merge, set, cloneDeep } from 'lodash/fp'; | |
import produce from 'immer'; | |
interface Street { | |
num: number; | |
name: string; | |
} |
With the introduction of GitHub's Squash and Merge feature, this has become less prevelant, however it's still useful in scenarios where GitHub's interface is unavailable.
Let's talk through two ways to do a squash and merge on the command line.
When to use it
import React from 'react'; | |
import { createStore } from 'redux'; | |
import { Provider } from 'react-redux'; | |
import { render } from '@testing-library/react'; | |
import reducer from '../../reducers'; | |
export const renderWithRedux = (component, initialState) => { | |
const store = createStore(reducer, initialState); | |
return { | |
...render(<Provider store={store}>{component}</Provider>), |
import React from 'react'; | |
import { Status } from './Status'; | |
import renderWithRedux from 'utils/renderWithRedux'; | |
test('When monster takes damage, show success message', () => { | |
const { getByText } = renderWithRedux(<Status />, { | |
monster: { damageTaken: 2 } | |
}); | |
expect(getByText('You hit for 2!')); | |
}); |
import React from 'react'; | |
import { Healthbar } from './Healthbar'; | |
import { render } from '@testing-library/react'; | |
test('show current health', () => { | |
const { getByText } = render( | |
<Healthbar position="left" playerName="Example Name" health={32} /> | |
); | |
expect(getByText('32')); | |
}); |
import configureMockStore from 'redux-mock-store'; | |
import thunk from 'redux-thunk'; | |
import rollDice from 'utils/rollDice'; | |
import { | |
initialState, | |
monsterActions, | |
monsterReducer, | |
monsterAttack, | |
getMonsterIsAttacking, | |
getMonsterDamage, |
requestedAction: ['NOTACTIONED'], | |
inProgressAction: ['REQUESTED'], | |
deliveredAction: ['INPROGRESS'], | |
fulfilledAction: ['DELIVERED'], | |
notRequiredAction: ['NOTACTIONED'], | |
cancelledAction: ['REQUESTED', 'INPROGRESS', 'DELIVERED'], | |
editDatesAction: ['REQUESTED', 'INPROGRESS', 'DELIVERED', 'FULFILLED'], | |
editRequestDateAction: ['REQUESTED', 'FULFILLED'], | |
editFulfilledDateAction: ['FULFILLED'], | |
editRequiredByAction: ['REQUESTED', 'INPROGRESS'] |
import { | |
IAssetRequestRecord, | |
RequestType | |
} from 'records/typescript/AssetRequest'; | |
import { createSelector } from 'reselect'; | |
import sortByDate from 'utils/sortByDate'; | |
import sortAlphbeticReverse from 'utils/sortAlphbeticReverse'; | |
import withAssetRequestsReducer, { | |
getAssetRequests, | |
initialAssetRequestsState, |
export default function withAssetRequestsReducer(originalReducer, reducerName) { | |
const actionTypes = { | |
FETCH_START: `${reducerName}/FETCH_START`, | |
FETCH_SUCCESS: `${reducerName}/FETCH_SUCCESS`, | |
FETCH_FAILURE: `${reducerName}/FETCH_FAILURE`, | |
UPDATE_START: `${reducerName}/UPDATE_START`, | |
UPDATE_SUCCESS: `${reducerName}/UPDATE_SUCCESS`, | |
UPDATE_FAILURE: `${reducerName}/UPDATE_FAILURE`, | |
NEXT_PAGE: `${reducerName}/NEXT_PAGE`, |