-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a1dadc9
commit c16063a
Showing
7 changed files
with
136 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
module.exports = { | ||
extends: 'airbnb-base', | ||
plugins: ['import'], | ||
extends: "airbnb-base", | ||
plugins: ["import"], | ||
env: { | ||
jest: true, | ||
jest: true | ||
}, | ||
rules: { | ||
'no-underscore-dangle': 'off', | ||
}, | ||
"no-underscore-dangle": "off", | ||
"linebreak-style": 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
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,34 @@ | ||
import asyncMiddleware from './asyncMiddleware'; | ||
|
||
describe('asyncMiddleware', () => { | ||
it('should call the action result when action is a function', () => { | ||
// Arrange | ||
const middleWare = asyncMiddleware({ dispatch: {}, getState: {} }); | ||
const next = () => {}; | ||
let actionWasCalled = false; | ||
const action = () => { | ||
actionWasCalled = true; | ||
}; | ||
|
||
// Act | ||
middleWare(next)(action); | ||
|
||
// Assert | ||
expect(actionWasCalled).toBe(true); | ||
}); | ||
it('should call next when action is not a function', () => { | ||
// Arrange | ||
const middleWare = asyncMiddleware({ dispatch: {}, getState: {} }); | ||
let nextWasCalled = false; | ||
const next = () => { | ||
nextWasCalled = true; | ||
}; | ||
const action = {}; | ||
|
||
// Act | ||
middleWare(next)(action); | ||
|
||
// Assert | ||
expect(nextWasCalled).toBe(true); | ||
}); | ||
}); |
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