Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
X
xpub-faraday
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
xpub
xpub-faraday
Commits
da9a54a6
Commit
da9a54a6
authored
6 years ago
by
Tania Fecheta
Browse files
Options
Downloads
Patches
Plain Diff
test(canHeMakeAnotherRecommendation): add unit tests for canHEMakeAnotherRecommendation
parent
eaadaee0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!176
Sprint 24
,
!171
Sprint 24
,
!157
fix(fragmentRecommendation): allow HE to make another recommendation on the same…
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/component-helper-service/src/tests/fragment.test.js
+91
-0
91 additions, 0 deletions
packages/component-helper-service/src/tests/fragment.test.js
with
91 additions
and
0 deletions
packages/component-helper-service/src/tests/fragment.test.js
+
91
−
0
View file @
da9a54a6
...
...
@@ -15,6 +15,8 @@ const { recommendations: configRecommendations } = config
const
acceptedReviewerId
=
chance
.
guid
()
const
submittedReviewerId1
=
chance
.
guid
()
const
submittedReviewerId2
=
chance
.
guid
()
const
handlingEditorId
=
chance
.
guid
()
const
editorInChiefId
=
chance
.
guid
()
const
fragment
=
{
invitations
:
[
{
...
...
@@ -281,4 +283,93 @@ describe('Fragment helper', () => {
}
})
})
describe
(
'
canHEMakeAnotherRecommendation
'
,
()
=>
{
it
(
'
should return true when He makes a recommendation after EIC decision was to return to HE
'
,
async
()
=>
{
testFragment
.
recommendations
=
[
{
recommendation
:
'
publish
'
,
recommendationType
:
'
editorRecommendation
'
,
comments
:
[
{
content
:
chance
.
paragraph
(),
public
:
true
,
files
:
[
{
id
:
chance
.
guid
(),
name
:
'
file.pdf
'
,
size
:
chance
.
natural
(),
},
],
},
],
id
:
chance
.
guid
(),
userId
:
handlingEditorId
,
createdOn
:
1542361074012
,
updatedOn
:
chance
.
timestamp
(),
},
{
recommendation
:
'
return-to-handling-editor
'
,
recommendationType
:
'
editorRecommendation
'
,
comments
:
[
{
content
:
chance
.
paragraph
(),
public
:
true
,
files
:
[
{
id
:
chance
.
guid
(),
name
:
'
file.pdf
'
,
size
:
chance
.
natural
(),
},
],
},
],
id
:
chance
.
guid
(),
userId
:
editorInChiefId
,
createdOn
:
1542361115749
,
updatedOn
:
chance
.
timestamp
(),
},
]
const
currentUserRecommendations
=
testFragment
.
recommendations
.
filter
(
r
=>
r
.
userId
===
handlingEditorId
,
)
const
fragmentHelper
=
new
Fragment
({
fragment
:
testFragment
})
const
canHEMakeAnotherRecommendation
=
await
fragmentHelper
.
canHEMakeAnotherRecommendation
(
currentUserRecommendations
,
)
expect
(
canHEMakeAnotherRecommendation
).
toBe
(
true
)
})
it
(
'
should return false when He makes another recommendation
'
,
async
()
=>
{
testFragment
.
recommendations
=
[
{
recommendation
:
'
publish
'
,
recommendationType
:
'
editorRecommendation
'
,
comments
:
[
{
content
:
chance
.
paragraph
(),
public
:
true
,
files
:
[
{
id
:
chance
.
guid
(),
name
:
'
file.pdf
'
,
size
:
chance
.
natural
(),
},
],
},
],
id
:
chance
.
guid
(),
userId
:
handlingEditorId
,
createdOn
:
1542361074012
,
updatedOn
:
chance
.
timestamp
(),
},
]
const
currentUserRecommendations
=
testFragment
.
recommendations
.
filter
(
r
=>
r
.
userId
===
handlingEditorId
,
)
const
fragmentHelper
=
new
Fragment
({
fragment
:
testFragment
})
const
canHEMakeAnotherRecommendation
=
await
fragmentHelper
.
canHEMakeAnotherRecommendation
(
currentUserRecommendations
,
)
expect
(
canHEMakeAnotherRecommendation
).
toBe
(
false
)
})
})
})
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment