-
-
Save marr/a3195dadb924a977a00a to your computer and use it in GitHub Desktop.
This file contains 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 test from 'tape' | |
import configureMockStore from 'redux-mock-store' | |
import thunk from 'redux-thunk' | |
import { asyncFindUsers } from '../actions' | |
import { FIND_USERS } from '../constants' | |
import nock from 'nock' | |
test('should find concierge user', (assert) => { | |
const middlewares = [ thunk ] | |
const mockStore = configureMockStore(middlewares) | |
const email = 'test-user@something.com' | |
nock('https://api.something.com') | |
.get(`/v1/account?country=US&email=${email}`) | |
.reply(200, { data: { email } }) | |
const expectedActions = [{ | |
type: FIND_USERS, | |
payload: [{ | |
}] | |
}] | |
const store = mockStore({ users: [] }, expectedActions, assert.end) | |
store.dispatch(asyncFindUsers(email)) | |
}); | |
test('after all', () => { | |
nock.cleanAll() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment