-
Notifications
You must be signed in to change notification settings - Fork 3k
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 #47860 from software-mansion-labs/approval-workflo…
…ws/simplify-hint-message [Advanced Approval Workflows] Update the hint text to be simpler
- Loading branch information
Showing
9 changed files
with
71 additions
and
68 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
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 |
---|---|---|
|
@@ -31,7 +31,6 @@ function buildApprover(accountID: number, approver: Partial<Approver> = {}): App | |
forwardsTo: undefined, | ||
avatar: 'https://d2k5nsl2zxldvw.cloudfront.net/images/avatars/avatar_7.png', | ||
displayName: `${accountID}@example.com User`, | ||
isInMultipleWorkflows: false, | ||
isCircularReference: false, | ||
...approver, | ||
}; | ||
|
@@ -201,9 +200,9 @@ describe('WorkflowUtils', () => { | |
const employees: PolicyEmployeeList = {}; | ||
const defaultApprover = '[email protected]'; | ||
|
||
const workflows = WorkflowUtils.convertPolicyEmployeesToApprovalWorkflows({employees, defaultApprover, personalDetails}); | ||
const {approvalWorkflows} = WorkflowUtils.convertPolicyEmployeesToApprovalWorkflows({employees, defaultApprover, personalDetails}); | ||
|
||
expect(workflows).toEqual([]); | ||
expect(approvalWorkflows).toEqual([]); | ||
}); | ||
|
||
it('Should transform all users into one default workflow', () => { | ||
|
@@ -221,9 +220,9 @@ describe('WorkflowUtils', () => { | |
}; | ||
const defaultApprover = '[email protected]'; | ||
|
||
const workflows = WorkflowUtils.convertPolicyEmployeesToApprovalWorkflows({employees, defaultApprover, personalDetails}); | ||
const {approvalWorkflows} = WorkflowUtils.convertPolicyEmployeesToApprovalWorkflows({employees, defaultApprover, personalDetails}); | ||
|
||
expect(workflows).toEqual([buildWorkflow([1, 2], [1], {isDefault: true})]); | ||
expect(approvalWorkflows).toEqual([buildWorkflow([1, 2], [1], {isDefault: true})]); | ||
}); | ||
|
||
it('Should transform all users into two workflows', () => { | ||
|
@@ -251,9 +250,9 @@ describe('WorkflowUtils', () => { | |
}; | ||
const defaultApprover = '[email protected]'; | ||
|
||
const workflows = WorkflowUtils.convertPolicyEmployeesToApprovalWorkflows({employees, defaultApprover, personalDetails}); | ||
const {approvalWorkflows} = WorkflowUtils.convertPolicyEmployeesToApprovalWorkflows({employees, defaultApprover, personalDetails}); | ||
|
||
expect(workflows).toEqual([buildWorkflow([2, 3], [1], {isDefault: true}), buildWorkflow([1, 4], [4])]); | ||
expect(approvalWorkflows).toEqual([buildWorkflow([2, 3], [1], {isDefault: true}), buildWorkflow([1, 4], [4])]); | ||
}); | ||
|
||
it('Should sort the workflows (first the default and then based on the first approver display name)', () => { | ||
|
@@ -286,9 +285,9 @@ describe('WorkflowUtils', () => { | |
}; | ||
const defaultApprover = '[email protected]'; | ||
|
||
const workflows = WorkflowUtils.convertPolicyEmployeesToApprovalWorkflows({employees, defaultApprover, personalDetails}); | ||
const {approvalWorkflows} = WorkflowUtils.convertPolicyEmployeesToApprovalWorkflows({employees, defaultApprover, personalDetails}); | ||
|
||
expect(workflows).toEqual([buildWorkflow([3, 2], [1], {isDefault: true}), buildWorkflow([5], [3]), buildWorkflow([4, 1], [4])]); | ||
expect(approvalWorkflows).toEqual([buildWorkflow([3, 2], [1], {isDefault: true}), buildWorkflow([5], [3]), buildWorkflow([4, 1], [4])]); | ||
}); | ||
|
||
it('Should mark approvers that are used in multiple workflows', () => { | ||
|
@@ -316,20 +315,16 @@ describe('WorkflowUtils', () => { | |
}; | ||
const defaultApprover = '[email protected]'; | ||
|
||
const workflows = WorkflowUtils.convertPolicyEmployeesToApprovalWorkflows({employees, defaultApprover, personalDetails}); | ||
const {approvalWorkflows} = WorkflowUtils.convertPolicyEmployeesToApprovalWorkflows({employees, defaultApprover, personalDetails}); | ||
|
||
const defaultWorkflow = buildWorkflow([2, 3, 4], [1, 3, 4], {isDefault: true}); | ||
defaultWorkflow.approvers[0].forwardsTo = '[email protected]'; | ||
defaultWorkflow.approvers[1].forwardsTo = '[email protected]'; | ||
defaultWorkflow.approvers[1].isInMultipleWorkflows = true; | ||
defaultWorkflow.approvers[2].isInMultipleWorkflows = true; | ||
const secondWorkflow = buildWorkflow([1], [2, 3, 4]); | ||
secondWorkflow.approvers[0].forwardsTo = '[email protected]'; | ||
secondWorkflow.approvers[1].forwardsTo = '[email protected]'; | ||
secondWorkflow.approvers[1].isInMultipleWorkflows = true; | ||
secondWorkflow.approvers[2].isInMultipleWorkflows = true; | ||
|
||
expect(workflows).toEqual([defaultWorkflow, secondWorkflow]); | ||
expect(approvalWorkflows).toEqual([defaultWorkflow, secondWorkflow]); | ||
}); | ||
|
||
it('Should build multiple workflows with many approvers', () => { | ||
|
@@ -367,13 +362,13 @@ describe('WorkflowUtils', () => { | |
}; | ||
const defaultApprover = '[email protected]'; | ||
|
||
const workflows = WorkflowUtils.convertPolicyEmployeesToApprovalWorkflows({employees, defaultApprover, personalDetails}); | ||
const {approvalWorkflows} = WorkflowUtils.convertPolicyEmployeesToApprovalWorkflows({employees, defaultApprover, personalDetails}); | ||
|
||
const defaultWorkflow = buildWorkflow([1, 4, 5, 6], [1], {isDefault: true}); | ||
const secondWorkflow = buildWorkflow([2, 3], [4, 5, 6]); | ||
secondWorkflow.approvers[0].forwardsTo = '[email protected]'; | ||
secondWorkflow.approvers[1].forwardsTo = '[email protected]'; | ||
expect(workflows).toEqual([defaultWorkflow, secondWorkflow]); | ||
expect(approvalWorkflows).toEqual([defaultWorkflow, secondWorkflow]); | ||
}); | ||
}); | ||
|
||
|