-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'TS08-TransferringUserToNuvemCivica' into devel
- Loading branch information
Showing
45 changed files
with
1,464 additions
and
1,061 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,86 @@ | ||
import applicationReducer from '../../src/Reducers/applicationReducer'; | ||
import initialState from '../../src/Reducers/initialState'; | ||
import { IS_LOADING, IS_NOT_LOADING } from '../../src/actions/types'; | ||
|
||
describe('Testing applicationReducer', () => { | ||
it('Is Loading', () => { | ||
let application = initialState.application; | ||
|
||
expect(application.isLoading).toBe(false); | ||
expect(application.message_erro).toBe(''); | ||
|
||
const sendedApplication = { | ||
isLoading: true, | ||
message_erro: '', | ||
}; | ||
|
||
const action = { | ||
type: IS_LOADING, | ||
payload: sendedApplication, | ||
}; | ||
|
||
application = applicationReducer(application, action); | ||
|
||
expect(application).toEqual(sendedApplication); | ||
}); | ||
|
||
it('Is not Loading', () => { | ||
let application = { | ||
...initialState.application, | ||
isLoading: true, | ||
}; | ||
|
||
expect(application.isLoading).toBe(true); | ||
expect(application.message_erro).toBe(''); | ||
|
||
const sendedApplication = { | ||
isLoading: false, | ||
message_erro: '', | ||
}; | ||
|
||
const action = { | ||
type: IS_NOT_LOADING, | ||
payload: sendedApplication, | ||
}; | ||
|
||
application = applicationReducer(application, action); | ||
|
||
expect(application).toEqual(sendedApplication); | ||
}); | ||
|
||
|
||
it('Default action type', () => { | ||
let application = initialState.application; | ||
|
||
expect(application.isLoading).toBe(false); | ||
expect(application.message_erro).toBe(''); | ||
|
||
const sendedApplication = application; | ||
|
||
const action = { | ||
type: 'DEFAULT_TYPE_TO_ACTION', | ||
payload: 'DEFAULT_VALUE_TO_ACTION', | ||
}; | ||
|
||
application = applicationReducer(application, action); | ||
|
||
expect(application).toEqual(sendedApplication); | ||
}); | ||
|
||
it('Undefined action sended', () => { | ||
let application = initialState.application; | ||
|
||
expect(application.isLoading).toBe(false); | ||
expect(application.message_erro).toBe(''); | ||
|
||
const sendedApplication = application; | ||
|
||
const action = undefined; | ||
|
||
expect(action).toBeUndefined(); | ||
|
||
application = applicationReducer(application, action); | ||
|
||
expect(application).toEqual(sendedApplication); | ||
}); | ||
}); |
This file was deleted.
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 |
---|---|---|
@@ -0,0 +1,192 @@ | ||
import counselorReducer from '../../src/Reducers/counselorReducer'; | ||
import initialState from '../../src/Reducers/initialState'; | ||
import { SET_COUNSELOR, SET_TOKEN, SET_COUNSELOR_EDITED } from '../../src/actions/types'; | ||
|
||
describe('Testing counselorReducer', () => { | ||
it('Sets counselor', () => { | ||
let counselor = initialState.counselor; | ||
|
||
expect(counselor.nuvemCode).toBe(0); | ||
expect(counselor.email).toBe(''); | ||
expect(counselor.name).toBe(''); | ||
expect(counselor.userName).toBe(''); | ||
expect(counselor.password).toBe(''); | ||
expect(counselor.token).toBe(''); | ||
expect(counselor.profile.cpf).toBe(''); | ||
expect(counselor.profile.phone).toBe(''); | ||
expect(counselor.profile.isPresident).toBe(false); | ||
expect(counselor.profile.segment).toBe(''); | ||
expect(counselor.profile.CAE_Type).toBe(''); | ||
expect(counselor.profile.CAE).toBe(''); | ||
|
||
const sendedCounselor = { | ||
nuvemCode: 1, | ||
email: '[email protected]', | ||
name: 'Rodolfo', | ||
userName: '[email protected]', | ||
password: 'senha', | ||
token: 'tokenGenerico', | ||
profile: { | ||
cpf: '12312312312', | ||
phone: '96661234', | ||
isPresident: false, | ||
segment: 'Titular', | ||
CAE_Type: 'Estadual', | ||
CAE: 'Distrito Federal', | ||
}, | ||
}; | ||
|
||
const action = { | ||
type: SET_COUNSELOR, | ||
payload: sendedCounselor, | ||
}; | ||
|
||
counselor = counselorReducer(counselor, action); | ||
|
||
expect(counselor).toEqual(sendedCounselor); | ||
}); | ||
|
||
it('Sets counselor token', () => { | ||
let counselor = initialState.counselor; | ||
|
||
expect(counselor.nuvemCode).toBe(0); | ||
expect(counselor.email).toBe(''); | ||
expect(counselor.name).toBe(''); | ||
expect(counselor.userName).toBe(''); | ||
expect(counselor.password).toBe(''); | ||
expect(counselor.token).toBe(''); | ||
expect(counselor.profile.cpf).toBe(''); | ||
expect(counselor.profile.phone).toBe(''); | ||
expect(counselor.profile.isPresident).toBe(false); | ||
expect(counselor.profile.segment).toBe(''); | ||
expect(counselor.profile.CAE_Type).toBe(''); | ||
expect(counselor.profile.CAE).toBe(''); | ||
|
||
const sendedCounselor = { | ||
nuvemCode: 0, | ||
email: '', | ||
name: '', | ||
userName: '', | ||
password: '', | ||
token: 'tokenGenerico', | ||
profile: { | ||
cpf: '', | ||
phone: '', | ||
isPresident: false, | ||
segment: '', | ||
CAE_Type: '', | ||
CAE: '', | ||
}, | ||
}; | ||
|
||
const action = { | ||
type: SET_TOKEN, | ||
payload: sendedCounselor.token, | ||
}; | ||
|
||
counselor = counselorReducer(counselor, action); | ||
|
||
expect(counselor).toEqual(sendedCounselor); | ||
}); | ||
|
||
it('Sets counselor edited', () => { | ||
let counselor = initialState.counselor; | ||
|
||
expect(counselor.nuvemCode).toBe(0); | ||
expect(counselor.email).toBe(''); | ||
expect(counselor.name).toBe(''); | ||
expect(counselor.userName).toBe(''); | ||
expect(counselor.password).toBe(''); | ||
expect(counselor.token).toBe(''); | ||
expect(counselor.profile.cpf).toBe(''); | ||
expect(counselor.profile.phone).toBe(''); | ||
expect(counselor.profile.isPresident).toBe(false); | ||
expect(counselor.profile.segment).toBe(''); | ||
expect(counselor.profile.CAE_Type).toBe(''); | ||
expect(counselor.profile.CAE).toBe(''); | ||
|
||
const sendedCounselor = { | ||
nuvemCode: 0, | ||
email: '', | ||
name: 'Romario', | ||
userName: '', | ||
password: '', | ||
token: '', | ||
profile: { | ||
cpf: '12312312312', | ||
phone: '987654321', | ||
isPresident: true, | ||
segment: 'Suplente', | ||
CAE_Type: 'Municipal', | ||
CAE: 'Porto Velho', | ||
}, | ||
}; | ||
|
||
const action = { | ||
type: SET_COUNSELOR_EDITED, | ||
payload: { | ||
name: sendedCounselor.name, | ||
profile: sendedCounselor.profile, | ||
}, | ||
}; | ||
|
||
counselor = counselorReducer(counselor, action); | ||
|
||
expect(counselor).toEqual(sendedCounselor); | ||
}); | ||
|
||
it('Default action type', () => { | ||
let counselor = initialState.counselor; | ||
|
||
expect(counselor.nuvemCode).toBe(0); | ||
expect(counselor.email).toBe(''); | ||
expect(counselor.name).toBe(''); | ||
expect(counselor.userName).toBe(''); | ||
expect(counselor.password).toBe(''); | ||
expect(counselor.token).toBe(''); | ||
expect(counselor.profile.cpf).toBe(''); | ||
expect(counselor.profile.phone).toBe(''); | ||
expect(counselor.profile.isPresident).toBe(false); | ||
expect(counselor.profile.segment).toBe(''); | ||
expect(counselor.profile.CAE_Type).toBe(''); | ||
expect(counselor.profile.CAE).toBe(''); | ||
|
||
const sendedCounselor = counselor; | ||
|
||
const action = { | ||
type: 'DEFAULT_TYPE_TO_ACTION', | ||
payload: 'DEFAULT_VALUE_TO_ACTION', | ||
}; | ||
|
||
counselor = counselorReducer(counselor, action); | ||
|
||
expect(counselor).toEqual(sendedCounselor); | ||
}); | ||
|
||
it('Undefined action sended', () => { | ||
let counselor = initialState.counselor; | ||
|
||
expect(counselor.nuvemCode).toBe(0); | ||
expect(counselor.email).toBe(''); | ||
expect(counselor.name).toBe(''); | ||
expect(counselor.userName).toBe(''); | ||
expect(counselor.password).toBe(''); | ||
expect(counselor.token).toBe(''); | ||
expect(counselor.profile.cpf).toBe(''); | ||
expect(counselor.profile.phone).toBe(''); | ||
expect(counselor.profile.isPresident).toBe(false); | ||
expect(counselor.profile.segment).toBe(''); | ||
expect(counselor.profile.CAE_Type).toBe(''); | ||
expect(counselor.profile.CAE).toBe(''); | ||
|
||
const sendedCounselor = counselor; | ||
|
||
const action = undefined; | ||
|
||
expect(action).toBeUndefined(); | ||
|
||
counselor = counselorReducer(counselor, action); | ||
|
||
expect(counselor).toEqual(sendedCounselor); | ||
}); | ||
}); |
Oops, something went wrong.