-
Notifications
You must be signed in to change notification settings - Fork 10
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 #46 from EmmanuelDemey/master
zenika
- Loading branch information
Showing
8 changed files
with
130 additions
and
23 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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import remove from './delete'; | ||
import * as A from 'js/actions/constants'; | ||
import api from 'js/remote-api/concepts-api'; | ||
|
||
const dispatch = jest.fn(); | ||
jest.mock('js/remote-api/concepts-api'); | ||
|
||
describe('Concepts actions', () => { | ||
it('should call dispatch DELETE_CONCEPT_SUCCESS action with the sorted array', async () => { | ||
api.deleteConcept = function() { | ||
return Promise.resolve([{ label: 'bbb' }, { label: 'aaa' }]); | ||
}; | ||
await remove(1)(dispatch); | ||
expect(dispatch).toHaveBeenCalledWith({ | ||
type: A.DELETE_CONCEPT, | ||
payload: { id: 1 }, | ||
}); | ||
expect(dispatch).toHaveBeenLastCalledWith({ | ||
type: A.DELETE_CONCEPT_SUCCESS, | ||
payload: { id: 1 }, | ||
}); | ||
}); | ||
|
||
it('should call dispatch DELETE_CONCEPT_FAILURE action with an error object', async () => { | ||
api.deleteConcept = function() { | ||
return Promise.reject('error'); | ||
}; | ||
await remove(1)(dispatch); | ||
expect(dispatch).toHaveBeenCalledWith({ | ||
type: A.DELETE_CONCEPT, | ||
payload: { id: 1 }, | ||
}); | ||
expect(dispatch).toHaveBeenLastCalledWith({ | ||
type: A.DELETE_CONCEPT_FAILURE, | ||
payload: { err: 'error', id: 1 }, | ||
}); | ||
}); | ||
}); |
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,38 @@ | ||
import get from './list'; | ||
import * as A from 'js/actions/constants'; | ||
import api from 'js/remote-api/concepts-api'; | ||
|
||
const dispatch = jest.fn(); | ||
jest.mock('js/remote-api/concepts-api'); | ||
|
||
describe('Concepts actions', () => { | ||
it('should call dispatch LOAD_CONCEPT_LIST_SUCCESS action with the sorted array', async () => { | ||
api.getConceptList = function() { | ||
return Promise.resolve([{ label: 'bbb' }, { label: 'aaa' }]); | ||
}; | ||
await get()(dispatch); | ||
expect(dispatch).toHaveBeenCalledWith({ | ||
type: A.LOAD_CONCEPT_LIST, | ||
payload: {}, | ||
}); | ||
expect(dispatch).toHaveBeenLastCalledWith({ | ||
type: A.LOAD_CONCEPT_LIST_SUCCESS, | ||
payload: { results: [{ label: 'aaa' }, { label: 'bbb' }] }, | ||
}); | ||
}); | ||
|
||
it('should call dispatch LOAD_CONCEPT_LIST_FAILURE action with an error object', async () => { | ||
api.getConceptList = function() { | ||
return Promise.reject('error'); | ||
}; | ||
await get()(dispatch); | ||
expect(dispatch).toHaveBeenCalledWith({ | ||
type: A.LOAD_CONCEPT_LIST, | ||
payload: {}, | ||
}); | ||
expect(dispatch).toHaveBeenLastCalledWith({ | ||
type: A.LOAD_CONCEPT_LIST_FAILURE, | ||
payload: { err: 'error' }, | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,6 +1,12 @@ | ||
export default { | ||
titleDocument: { fr: 'Documents', en: 'Documents' }, | ||
titleLink: { fr: 'Liens', en: 'Links' }, | ||
addDocument: { | ||
fr: 'Ajoutez un document', | ||
en: 'Add a document', | ||
}, | ||
addLink: { | ||
fr: 'Ajoutez un lien', | ||
en: 'Add a lien', | ||
}, | ||
}; |
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