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
| version: '3.8' | |
| services: | |
| db: | |
| image: timescale/timescaledb-ha:pg17 | |
| container_name: timescaledb | |
| restart: always | |
| environment: | |
| POSTGRES_PASSWORD: postgres | |
| ports: |
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 walkDOMTree( | |
| root, | |
| whatToShow = NodeFilter.SHOW_ALL, | |
| { inspect, collect, callback } = {} | |
| ) { | |
| const walker = document.createTreeWalker(root, whatToShow, { | |
| acceptNode(node) { | |
| if (inspect && !inspect(node)) { | |
| return NodeFilter.FILTER_REJECT; | |
| } |
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 {mockFetchResponse} from 'test-utils/mock-fetch-response'; | |
| test(`logging in displays the user's username`, async () => { | |
| const {mockSuccessResponse, fetchPromise} = mockFetchResponse(); | |
| window.fetch = jest.fn().mockReturnValueOnce(fetchPromise); | |
| render(<Login />) | |
| const {username, password} = buildLoginForm() | |
| userEvent.type(screen.getByLabelText(/username/i), username) | |
| userEvent.type(screen.getByLabelText(/password/i), password) |
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
| module.exports = { | |
| env: { | |
| browser: true, | |
| es2021: true, | |
| node: true, | |
| }, | |
| extends: [ | |
| 'plugin:react/recommended', | |
| 'plugin:prettier/recommended', | |
| 'plugin:react-hooks/recommended', |
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
| { | |
| "printWidth": 160, | |
| "tabWidth": 2, | |
| "useTabs": false, | |
| "semi": true, | |
| "singleQuote": true, | |
| "trailingComma": "es5", | |
| "bracketSpacing": true, | |
| "jsxBracketSameLine": false, | |
| "arrowParens": "always" |
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 withStateSlice(Comp, slice) { | |
| const MemoComp = React.memo(Comp); | |
| function Wrapper(props, ref) { | |
| const state = useAppState(); | |
| const cell = slice(state, props); | |
| return <MemoComp ref={ref} state={cell} {...props} />; | |
| } | |
| Wrapper.displayName = `withStateSlice(${Comp.displayName || Comp.name})`; | |
| return React.memo(React.forwardRef(Wrapper)); | |
| } |
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
Show hidden characters
| { | |
| "presets": [ | |
| "env" | |
| ] | |
| } |
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
| const capitalize = require('./index'); | |
| test('Capitalize is a function', () => { | |
| expect(typeof capitalize).toEqual('function'); | |
| }); | |
| test('capitalizes the first letter of every word in a sentence', () => { | |
| expect(capitalize('hi there, how is it going?')).toEqual( | |
| 'Hi There, How Is It Going?' | |
| ); |
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
| { | |
| "singleQuote": true, | |
| "useTabs": true, | |
| "tabWidth": 2, | |
| "trailingComma": "es5", | |
| "endOfLine": "lf", | |
| "printWidth": 80, | |
| "semi": true | |
| } |
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
| // We declare our mapper function, context aware | |
| function mapProductId(transactionsArray) { | |
| return transactionsArray | |
| .map(transaction => ({ | |
| ...transaction, | |
| productId: this.getProductId(transaction.id) | |
| })) | |
| } | |
| // And now, we can transform our data like so |
NewerOlder