-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from blairg/finish_off_redux
Finish off redux
- Loading branch information
Showing
18 changed files
with
140 additions
and
36 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,7 @@ | |
"winston": "^2.4.0" | ||
}, | ||
"engines": { | ||
"node": "8.9.1", | ||
"npm": "5.5.1" | ||
"node": "8.9.3", | ||
"npm": "5.6.0" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
echo "pre-commit hook" | ||
|
||
echo "running -> npm test" | ||
# Run tests | ||
npm test | ||
|
||
echo "running -> npm run pretty" | ||
# Run prettier before committing | ||
npm run pretty |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export const SET_TITLE = 'SET_TITLE'; | ||
export const SET_BODY = 'SET_BODY'; | ||
export const ADD_POST = 'ADD_POST'; | ||
export const SET_TODOS = 'SET_TODOS'; |
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* eslint-disable no-undef */ | ||
/* eslint-disable react/jsx-filename-extension */ | ||
/* eslint-disable import/extensions */ | ||
|
||
import assert from 'assert'; | ||
import sinon from 'sinon'; | ||
import Axios from 'axios'; | ||
import MockAdapter from 'axios-mock-adapter'; | ||
|
||
import CreateTodo from './../../../../src/client/components/containers/createTodo.jsx'; | ||
|
||
const sandbox = sinon.sandbox.create(); | ||
let mockAxios; | ||
|
||
describe('client/components/containers/createTodo -> <CreateTodo />', () => { | ||
const event = { preventDefault: () => {} }; | ||
|
||
beforeEach(() => { | ||
mockAxios = new MockAdapter(Axios); | ||
sandbox.stub(event, 'preventDefault'); | ||
sandbox.stub(console, 'error'); | ||
}); | ||
|
||
afterEach(() => { | ||
mockAxios.reset(); | ||
sandbox.restore(); | ||
}); | ||
|
||
describe('CreateTodo.handleDelete(event)', () => { | ||
it('should call Axios.delete and event.preventDefault()', async () => { | ||
mockAxios.onDelete('/todos').reply(200); | ||
const success = await CreateTodo.handleDelete(event); | ||
|
||
assert.equal(event.preventDefault.called, true); | ||
assert.equal(success, true); | ||
}); | ||
|
||
it('should call Axios.delete and throw error', async () => { | ||
mockAxios.onDelete('/todos').networkError(); | ||
const success = await CreateTodo.handleDelete(event); | ||
|
||
assert.equal(event.preventDefault.called, true); | ||
assert.equal(success, false); | ||
}); | ||
}); | ||
}); |
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