-
Couldn't load subscription status.
- Fork 42
feat(CallLogger): Support transferred call #1388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sophiewu2333
merged 6 commits into
ringcentral:master
from
sophiewu2333:fea/transfer-issue
Oct 18, 2018
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
368ece9
feat(CallLogger): Support transferred call
sophiewu2333 c22e808
remove unused code
sophiewu2333 e29b5ec
save transferredcalls map into cache
sophiewu2333 8c3e304
use array to store transfer call data
sophiewu2333 f84a3e2
revert the changes
sophiewu2333 28b98ce
revert the changes
sophiewu2333 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
225 changes: 135 additions & 90 deletions
225
packages/ringcentral-integration/modules/CallLogger/getDataReducer.test.js
This file contains hidden or 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,92 +1,137 @@ | ||
| // import { expect } from 'chai'; | ||
| // import { | ||
| // getAutoLogReducer, | ||
| // getLogOnRingingReducer, | ||
| // } from './getDataReducer'; | ||
| // import actionTypes from './actionTypes'; | ||
| import { expect } from 'chai'; | ||
| import { | ||
| getAutoLogReducer, | ||
| getLogOnRingingReducer, | ||
| getTransferredCallsReducer | ||
| } from './getDataReducer'; | ||
| import actionTypes from './actionTypes'; | ||
|
|
||
| // describe('getAutoLogReducer', () => { | ||
| // it('should be a function', () => { | ||
| // expect(getAutoLogReducer).to.be.a('function'); | ||
| // }); | ||
| // it('should return a function', () => { | ||
| // expect(getAutoLogReducer(actionTypes)).to.be.a('function'); | ||
| // }); | ||
| // describe('autoLogReducer', () => { | ||
| // const reducer = getAutoLogReducer(actionTypes); | ||
| // it('should have initial state of true', () => { | ||
| // expect(reducer(undefined, {})).to.equal(true); | ||
| // }); | ||
| // it('should return true when type === setAutoLog and action.autoLog is true', () => { | ||
| // expect(reducer(true, { | ||
| // type: actionTypes.setAutoLog, | ||
| // autoLog: true, | ||
| // })).to.equal(true); | ||
| // expect(reducer(false, { | ||
| // type: actionTypes.setAutoLog, | ||
| // autoLog: true, | ||
| // })).to.equal(true); | ||
| // }); | ||
| // it('should return true when type === setAutoLog and action.autoLog is false', () => { | ||
| // expect(reducer(true, { | ||
| // type: actionTypes.setAutoLog, | ||
| // autoLog: false, | ||
| // })).to.equal(false); | ||
| // expect(reducer(false, { | ||
| // type: actionTypes.setAutoLog, | ||
| // autoLog: false, | ||
| // })).to.equal(false); | ||
| // }); | ||
| // it('should return originalState for other actionTypes', () => { | ||
| // const originalState = {}; | ||
| // expect(reducer(originalState, { | ||
| // type: 'foo', | ||
| // })).to.equal(originalState); | ||
| // }); | ||
| // }); | ||
| // }); | ||
| describe('getAutoLogReducer', () => { | ||
| it('should be a function', () => { | ||
| expect(getAutoLogReducer).to.be.a('function'); | ||
| }); | ||
| it('should return a function', () => { | ||
| expect(getAutoLogReducer(actionTypes)).to.be.a('function'); | ||
| }); | ||
| describe('autoLogReducer', () => { | ||
| const reducer = getAutoLogReducer(actionTypes); | ||
| it('should have initial state of true', () => { | ||
| expect(reducer(undefined, {})).to.equal(true); | ||
| }); | ||
| it('should return true when type === setAutoLog and action.autoLog is true', () => { | ||
| expect(reducer(true, { | ||
| type: actionTypes.setAutoLog, | ||
| autoLog: true, | ||
| })).to.equal(true); | ||
| expect(reducer(false, { | ||
| type: actionTypes.setAutoLog, | ||
| autoLog: true, | ||
| })).to.equal(true); | ||
| }); | ||
| it('should return true when type === setAutoLog and action.autoLog is false', () => { | ||
| expect(reducer(true, { | ||
| type: actionTypes.setAutoLog, | ||
| autoLog: false, | ||
| })).to.equal(false); | ||
| expect(reducer(false, { | ||
| type: actionTypes.setAutoLog, | ||
| autoLog: false, | ||
| })).to.equal(false); | ||
| }); | ||
| it('should return originalState for other actionTypes', () => { | ||
| const originalState = {}; | ||
| expect(reducer(originalState, { | ||
| type: 'foo', | ||
| })).to.equal(originalState); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| // describe('getLogOnRingingReducer', () => { | ||
| // it('should be a function', () => { | ||
| // expect(getLogOnRingingReducer).to.be.a('function'); | ||
| // }); | ||
| // it('should return a function', () => { | ||
| // expect(getLogOnRingingReducer(actionTypes)).to.be.a('function'); | ||
| // }); | ||
| // describe('logOnRingingReducer', () => { | ||
| // const reducer = getLogOnRingingReducer(actionTypes); | ||
| // it('should have initial state of true', () => { | ||
| // expect(reducer(undefined, {})).to.equal(true); | ||
| // }); | ||
| // it('should return true when type === setLogOnRinging and action.logOnRinging is true', | ||
| // () => { | ||
| // expect(reducer(true, { | ||
| // type: actionTypes.setLogOnRinging, | ||
| // logOnRinging: true, | ||
| // })).to.equal(true); | ||
| // expect(reducer(false, { | ||
| // type: actionTypes.setLogOnRinging, | ||
| // logOnRinging: true, | ||
| // })).to.equal(true); | ||
| // }, | ||
| // ); | ||
| // it('should return true when type === setLogOnRinging and action.logOnRinging is false', | ||
| // () => { | ||
| // expect(reducer(true, { | ||
| // type: actionTypes.setLogOnRinging, | ||
| // logOnRinging: false, | ||
| // })).to.equal(false); | ||
| // expect(reducer(false, { | ||
| // type: actionTypes.setLogOnRinging, | ||
| // logOnRinging: false, | ||
| // })).to.equal(false); | ||
| // }, | ||
| // ); | ||
| // it('should return originalState for other actionTypes', () => { | ||
| // const originalState = {}; | ||
| // expect(reducer(originalState, { | ||
| // type: 'foo', | ||
| // })).to.equal(originalState); | ||
| // }); | ||
| // }); | ||
| // }); | ||
| describe('getLogOnRingingReducer', () => { | ||
| it('should be a function', () => { | ||
| expect(getLogOnRingingReducer).to.be.a('function'); | ||
| }); | ||
| it('should return a function', () => { | ||
| expect(getLogOnRingingReducer(actionTypes)).to.be.a('function'); | ||
| }); | ||
| describe('logOnRingingReducer', () => { | ||
| const reducer = getLogOnRingingReducer(actionTypes); | ||
| it('should have initial state of true', () => { | ||
| expect(reducer(undefined, {})).to.equal(true); | ||
| }); | ||
| it('should return true when type === setLogOnRinging and action.logOnRinging is true', | ||
| () => { | ||
| expect(reducer(true, { | ||
| type: actionTypes.setLogOnRinging, | ||
| logOnRinging: true, | ||
| })).to.equal(true); | ||
| expect(reducer(false, { | ||
| type: actionTypes.setLogOnRinging, | ||
| logOnRinging: true, | ||
| })).to.equal(true); | ||
| }, | ||
| ); | ||
| it('should return true when type === setLogOnRinging and action.logOnRinging is false', | ||
| () => { | ||
| expect(reducer(true, { | ||
| type: actionTypes.setLogOnRinging, | ||
| logOnRinging: false, | ||
| })).to.equal(false); | ||
| expect(reducer(false, { | ||
| type: actionTypes.setLogOnRinging, | ||
| logOnRinging: false, | ||
| })).to.equal(false); | ||
| }, | ||
| ); | ||
| it('should return originalState for other actionTypes', () => { | ||
| const originalState = {}; | ||
| expect(reducer(originalState, { | ||
| type: 'foo', | ||
| })).to.equal(originalState); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| describe('getTransferredCallsReducer', () => { | ||
| it('should be a function', () => { | ||
| expect(getTransferredCallsReducer).to.be.a('function'); | ||
| }); | ||
| it('should return a function', () => { | ||
| expect(getTransferredCallsReducer(actionTypes)).to.be.a('function'); | ||
| }); | ||
| describe('getTransferredCallsReducer', () => { | ||
| const opacity = 5; | ||
| const reducer = getTransferredCallsReducer(actionTypes, opacity); | ||
| it('should have initial state of []', () => { | ||
| expect(reducer(undefined, {})).to.deep.equal([]); | ||
| }); | ||
| it('should return original state when actionType is not recognized', () => { | ||
| const originalState = [{ 123: true }]; | ||
| expect(reducer(originalState, { type: 'foo' })) | ||
| .to.deep.equal(originalState); | ||
| }); | ||
| it('should add new matcher when actionType is addTransferredCall', () => { | ||
| const originalState = [{ | ||
| 123: true | ||
| }]; | ||
| expect(reducer(originalState, { | ||
| type: actionTypes.addTransferredCall, | ||
| sessionId: '456', | ||
| })).to.deep.equal([{ 123: true }, { 456: true }]); | ||
| }); | ||
| it('should remove oldest matcher when actionType is addTransferredCall andsize of temporary matcher exceed the opacity', () => { | ||
| const originalState = []; | ||
| const opacity = 5; | ||
| originalState.push({ 1: true }, { 2: true }, { 3: true }, { 4: true }, { 5: true }); | ||
| expect(originalState.length).to.equal(opacity); | ||
| expect(reducer(originalState, { | ||
| type: actionTypes.addTransferredCall, | ||
| sessionId: '456', | ||
| }).length).to.equal(opacity); | ||
| expect(reducer(originalState, { | ||
| type: actionTypes.addTransferredCall, | ||
| sessionId: '456', | ||
| })[opacity - 1]).to.deep.equal({ 456: true }); | ||
| }); | ||
| }); | ||
| }); |
This file contains hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think when we remove '=', we need to consider if it has any impact for call secenario.
I think QAs need to do call scenario tests as many as possible.