Skip to content

Instantly share code, notes, and snippets.

View iamchanii's full-sized avatar
📚

Chanhee Lee iamchanii

📚
View GitHub Profile
import mockCreateRequests from '../../testing/mockCreateRequests';
// mocking
jest.mock('../../cms/hooks/useCreateRequests', () => () => mockCreateRequests);
// and then
it('foo', () => {
const error = new APIErrorDummy().create(400, PlayitemAPIError.Create.LayoutIdRequired);
mockCreateRequests.createRequests.mockImplementation(() => Promise.reject(error));
@iamchanii
iamchanii / fetchSaga.test.ts
Created February 12, 2019 06:43
redux-saga
it('payload 에 callback 파라미터를 넣으면 완료 후 해당 callback 을 실행한다.', (done) => {
apiResult = new ScreenDummy().create();
fetchMock.mockResponseOnce(JSON.stringify(apiResult));
const callback = jest.fn();
action = FetchActions.getOne('foo', 1, callback);
expectSaga(fetchSaga)
.withReducer(reducer, state)
.dispatch(action)
.put(MiscActions.setLoading(true))
#!/bin/bash
set -e
GVERSION="1.10.1"
GFILE="go$GVERSION.linux-amd64.tar.gz"
GOPATH="$HOME/go"
GOROOT="/usr/local/go"
if [ -d $GOROOT ]; then
echo "Installation directories already exist $GOROOT"