Commit 23ad04a5 authored by Jean Rabreau's avatar Jean Rabreau
Browse files

馃摑update profile doc

parent 6c8f89ff
......@@ -24,10 +24,18 @@ import { pick, cloneDeep } from 'lodash/fp'
* @typedef {Object} UserInfo
* @property {string} bio
* @property {string} institution
* @property {string} researchLab
* @property {UserStructure[]} researchLabs
* @property {string[]} otherAffiliations
*/
/**
* @typedef {Object} UserStructure
* @property {string} label
* @property {string} acronym
* @property {string} longName
* @property {string} shortName
*/
/**
* @typedef {Object} UserProfile
* @property {String} username
......@@ -44,7 +52,7 @@ import { pick, cloneDeep } from 'lodash/fp'
const userInfoInit = {
bio: '',
institution: '',
researchLab: '',
researchLabs: [{label: '', acronym: '',shortName: '', longName: ''}],
otherAffiliations: []
}
......@@ -90,6 +98,7 @@ const Contrib = {
lastName: state.profile.lastName,
firstName: state.profile.firstName,
info: state.profile.info,
email: state.profile.email
}),
},
mutations: {
......
......@@ -44,7 +44,7 @@ describe('store/contrib', () => {
isExternal: false,
info: {
bio: 'on vacation',
researchLab: 'lab',
researchLabs: 'lab',
institution: '',
otherAffiliations: []
},
......@@ -227,11 +227,11 @@ describe('store/contrib', () => {
expect(store.state.contrib.profile.info).to.eql(userInfoInit)
})
it('should set missing user profile info to default init value', async () => {
const receivedProfile = { ...userProfile, info: {researchLab: 'ru', otherAffiliations: []}}
const receivedProfile = { ...userProfile, info: {researchLabs: 'ru', otherAffiliations: []}}
getStub.returns(Promise.resolve({data: receivedProfile}))
await store.dispatch('contrib/loadProfile', userId)
expect(store.state.contrib.profile.info.institution).to.equal(userInfoInit.institution)
expect(store.state.contrib.profile.info.researchLab).to.equal('ru')
expect(store.state.contrib.profile.info.researchLabs).to.equal('ru')
})
it('should dispatch a failure notification for error', async () => {
getStub.returns(Promise.reject(axiosError))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment