Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.

Commit

Permalink
fix(actoins): fix tests
Browse files Browse the repository at this point in the history
fix(actoins): fix tests
  • Loading branch information
Metnew committed Dec 5, 2017
1 parent b260685 commit ad3fcf6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 28 deletions.
10 changes: 0 additions & 10 deletions src/common/actions/auth/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ const mockStore = configureMockStore(middlewares)

describe('Auth actions', () => {
describe('LOGIN_AUTH', () => {
const loginPending = {
meta: null,
type: LOGIN_AUTH_PENDING
}
/**
* @arg {Function} done - is a callback that you need to execute,
* If your action performing async task (e.g. request to API)
*/
test('creates LOGIN_AUTH_SUCCESS when LOGIN_AUTH was successful', done => {
const successPayload = {
token: 'nothing'
Expand All @@ -37,7 +29,6 @@ describe('Auth actions', () => {
.reply(200, successPayload)
// Create expected output of your action
const expectedActions = [
loginPending,
{
type: LOGIN_AUTH_SUCCESS,
payload: successPayload
Expand All @@ -61,7 +52,6 @@ describe('Auth actions', () => {
}

const expectedActions = [
loginPending,
{
type: LOGIN_AUTH_FAIL,
error: true,
Expand Down
23 changes: 5 additions & 18 deletions src/common/actions/layout/index.test.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,22 @@
import configureMockStore from 'redux-mock-store'
import thunk from 'redux-thunk'
import {
UI_CLOSE_SIDEBAR,
CLOSE_SIDEBAR,
UI_OPEN_SIDEBAR,
OPEN_SIDEBAR,
UI_TOGGLE_SIDEBAR,
TOGGLE_SIDEBAR,
UI_WINDOW_RESIZE,
WINDOW_RESIZE
} from 'actions/layout'
const middlewares = [thunk]
const mockStore = configureMockStore(middlewares)

describe('Layout actions', () => {
it('creates UI_CLOSE_SIDEBAR after CLOSE_SIDEBAR was dispatched', () => {
it('creates UI_TOGGLE_SIDEBAR after TOGGLE_SIDEBAR was dispatched', () => {
const expectedAction = [{
type: UI_CLOSE_SIDEBAR
type: UI_TOGGLE_SIDEBAR
}]

const store = mockStore({})
store.dispatch(CLOSE_SIDEBAR())

expect(store.getActions()).toEqual(expectedAction)
})

it('creates UI_OPEN_SIDEBAR after OPEN_SIDEBAR was dispatched', () => {
const expectedAction = [{
type: UI_OPEN_SIDEBAR
}]

const store = mockStore({})
store.dispatch(OPEN_SIDEBAR())
store.dispatch(TOGGLE_SIDEBAR())

expect(store.getActions()).toEqual(expectedAction)
})
Expand Down

0 comments on commit ad3fcf6

Please sign in to comment.