This repository has been archived by the owner on Aug 27, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
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 #33 from get-focus/feature-list-test
Feature list test
- Loading branch information
Showing
15 changed files
with
355 additions
and
63 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
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
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,62 @@ | ||
import fieldMiddleware from '../field'; | ||
import { | ||
INPUT_CHANGE, | ||
INPUT_BLUR, | ||
INPUT_ERROR, | ||
INPUT_BLUR_LIST, | ||
INPUT_ERROR_LIST | ||
} from '../../actions/input' | ||
import {definitions, domains} from '../../example/config'; | ||
describe('The field middleware', () => { | ||
const getStateSpy = sinon.spy(); | ||
const nextSpy = sinon.spy(); | ||
const dispatchSpy = sinon.spy(); | ||
const store = { | ||
getState: () => { | ||
getStateSpy(); | ||
return { | ||
dataset: { | ||
user: { | ||
data: { | ||
firstName: 'Joe', | ||
lastName: 'Lopez' | ||
}, | ||
loading: true, | ||
saving: false | ||
} | ||
}, | ||
definitions, | ||
domains, | ||
forms: [{ | ||
formKey: 'formKey', | ||
entityPathArray: ['user'], | ||
fields: [{ | ||
name: 'firstName', | ||
dataSetValue: 'Joe', | ||
entityPath: 'user', | ||
loading: false, | ||
saving: false | ||
}] | ||
}] | ||
} | ||
}, | ||
dispatch: dispatchSpy | ||
}; | ||
beforeEach(() => { | ||
getStateSpy.reset(); | ||
nextSpy.reset(); | ||
dispatchSpy.reset(); | ||
}); | ||
describe('when no store is given tho the middleware ', ()=>{ | ||
it('should throw an error', () =>{ | ||
expect(() => fieldMiddleware()(nextSpy)({type: 'lol'})) | ||
.to.throw('FIELD_MIDDLEWARE: Your middleware needs a redux store.'); | ||
}); | ||
it('when an INPUT_BLUR action is passed', () => { | ||
fieldMiddleware(store)(nextSpy)({type: INPUT_BLUR, entityPath: 'user', fieldName: 'firstName'}) | ||
}); | ||
it('when an INPUT_BLUR_LIST action is passed', () => {}); | ||
it('when an INPUT_CHANGE action is passed', () => {}); | ||
it('when an SYNC_FORM_ENTITIES action is passed', () => {}); | ||
}); | ||
}); |
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
Oops, something went wrong.