Skip to content

Instantly share code, notes, and snippets.

View AlvinTheDeveloper's full-sized avatar

Alvin Lau AlvinTheDeveloper

View GitHub Profile
@rishabh-ink
rishabh-ink / ExampleComponent.test.js
Last active February 8, 2023 02:20
Mocking and testing fetch with Jest
import { shallow } from 'enzyme';
import ExampleComponent from './ExampleComponent';
describe('ExampleComponent', () => {
it('fetches data from server when server returns a successful response', done => { // 1
const mockSuccessResponse = {};
const mockJsonPromise = Promise.resolve(mockSuccessResponse); // 2
const mockFetchPromise = Promise.resolve({ // 3
json: () => mockJsonPromise,
@evantoli
evantoli / GitConfigHttpProxy.md
Last active August 12, 2025 15:29
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@MarcDiethelm
MarcDiethelm / Contributing.md
Last active August 21, 2025 06:42
How to contribute to a project on Github

This text now lives at https://github.com/MarcDiethelm/contributing/blob/master/README.md. I turned it into a Github repo so you can, you know, contribute to it by making pull requests.


Contributing

If you want to contribute to a project and make it better, your help is very welcome. Contributing is also a great way to learn more about social coding on Github, new technologies and and their ecosystems and how to make constructive, helpful bug reports, feature requests and the noblest of all contributions: a good, clean pull request.