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
0bac02ef
Commit
0bac02ef
authored
6 years ago
by
Anca Ursachi
Browse files
Options
Downloads
Plain Diff
fix(mergeConflicts):
parents
c12ab558
e3999201
No related branches found
No related tags found
2 merge requests
!110
Sprint 21 Features
,
!92
Hin 946
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/xpub-faraday/config/authsome-helpers.js
+11
-0
11 additions, 0 deletions
packages/xpub-faraday/config/authsome-helpers.js
packages/xpub-faraday/tests/config/authsome-helpers.test.js
+119
-71
119 additions, 71 deletions
packages/xpub-faraday/tests/config/authsome-helpers.test.js
with
130 additions
and
71 deletions
packages/xpub-faraday/config/authsome-helpers.js
+
11
−
0
View file @
0bac02ef
...
...
@@ -180,6 +180,17 @@ const stripeFragmentByRole = ({
?
recommendations
.
filter
(
r
=>
r
.
userId
===
user
.
id
)
:
[],
}
case
'
handlingEditor
'
:
return
{
...
fragment
,
recommendations
:
recommendations
?
recommendations
.
filter
(
r
=>
r
.
submittedOn
||
r
.
recommendationType
===
'
editorRecommendation
'
,
)
:
[],
}
default
:
return
fragment
}
...
...
This diff is collapsed.
Click to expand it.
packages/xpub-faraday/tests/config/authsome-helpers.test.js
+
119
−
71
View file @
0bac02ef
...
...
@@ -88,81 +88,129 @@ describe('Authsome Helpers', () => {
expect
(
result
.
handlingEditor
).
toBeFalsy
()
})
it
(
'
stripeFragment - reviewer should not see authors email
'
,
()
=>
{
const
{
fragment
}
=
testFixtures
.
fragments
const
result
=
ah
.
stripeFragmentByRole
({
fragment
,
role
:
'
reviewer
'
})
const
{
authors
=
[]
}
=
result
expect
(
authors
[
0
].
email
).
toBeFalsy
()
})
it
(
'
stripeFragment - other roles than reviewer should see authors emails
'
,
()
=>
{
const
{
fragment
}
=
testFixtures
.
fragments
const
result
=
ah
.
stripeFragmentByRole
({
fragment
,
role
:
'
author
'
})
const
{
authors
=
[]
}
=
result
describe
(
'
stripeFragmentByRole
'
,
()
=>
{
it
(
'
reviewer should not see authors email
'
,
()
=>
{
const
{
fragment
}
=
testFixtures
.
fragments
const
result
=
ah
.
stripeFragmentByRole
({
fragment
,
role
:
'
reviewer
'
})
const
{
authors
=
[]
}
=
result
expect
(
authors
[
0
].
email
).
toBeFalsy
()
})
it
(
'
other roles than reviewer should see authors emails
'
,
()
=>
{
const
{
fragment
}
=
testFixtures
.
fragments
const
result
=
ah
.
stripeFragmentByRole
({
fragment
,
role
:
'
author
'
})
const
{
authors
=
[]
}
=
result
expect
(
authors
[
0
].
email
).
toBeTruthy
()
})
expect
(
authors
[
0
].
email
).
toBeTruthy
()
})
it
(
'
stripeFragment -
reviewer should not see cover letter
'
,
()
=>
{
const
{
fragment
}
=
testFixtures
.
fragments
const
result
=
ah
.
stripeFragmentByRole
({
fragment
,
role
:
'
reviewer
'
})
const
{
files
=
{}
}
=
result
expect
(
files
.
coverLetter
).
toBeFalsy
()
})
it
(
'
stripeFragment -
reviewer should not see others reviews
'
,
()
=>
{
const
{
fragment
}
=
testFixtures
.
fragments
const
result
=
ah
.
stripeFragmentByRole
({
fragment
,
role
:
'
reviewer
'
})
const
{
recommendations
}
=
result
expect
(
recommendations
).
toEqual
([])
})
it
(
'
reviewer should not see cover letter
'
,
()
=>
{
const
{
fragment
}
=
testFixtures
.
fragments
const
result
=
ah
.
stripeFragmentByRole
({
fragment
,
role
:
'
reviewer
'
})
const
{
files
=
{}
}
=
result
expect
(
files
.
coverLetter
).
toBeFalsy
()
})
it
(
'
reviewer should not see others reviews
'
,
()
=>
{
const
{
fragment
}
=
testFixtures
.
fragments
const
result
=
ah
.
stripeFragmentByRole
({
fragment
,
role
:
'
reviewer
'
})
const
{
recommendations
}
=
result
expect
(
recommendations
).
toEqual
([])
})
it
(
'
stripeFragment - author should not see recommendations if a decision has not been made
'
,
()
=>
{
const
{
fragment
}
=
testFixtures
.
fragments
fragment
.
recommendations
=
[
{
comments
:
[
{
content
:
'
private
'
,
public
:
false
,
},
{
content
:
'
public
'
,
public
:
true
,
},
],
},
]
const
{
recommendations
}
=
ah
.
stripeFragmentByRole
({
fragment
,
role
:
'
author
'
,
status
:
'
underReview
'
,
isLast
:
true
,
})
expect
(
recommendations
).
toHaveLength
(
0
)
})
it
(
'
stripeFragment - author should see reviews only if recommendation has been made and only public ones
'
,
()
=>
{
const
{
fragment
}
=
testFixtures
.
fragments
fragment
.
recommendations
=
[
{
comments
:
[
{
content
:
'
private
'
,
public
:
false
,
},
{
content
:
'
public
'
,
public
:
true
,
},
],
},
]
const
result
=
ah
.
stripeFragmentByRole
({
fragment
,
role
:
'
author
'
,
status
:
'
revisionRequested
'
,
})
const
publicComments
=
get
(
result
,
'
recommendations[0].comments
'
)
expect
(
publicComments
).
toHaveLength
(
1
)
it
(
'
author should not see recommendations if a decision has not been made
'
,
()
=>
{
const
{
fragment
}
=
testFixtures
.
fragments
fragment
.
recommendations
=
[
{
comments
:
[
{
content
:
'
private
'
,
public
:
false
,
},
{
content
:
'
public
'
,
public
:
true
,
},
],
},
]
const
{
recommendations
}
=
ah
.
stripeFragmentByRole
({
fragment
,
role
:
'
author
'
,
status
:
'
underReview
'
,
isLast
:
true
,
})
expect
(
recommendations
).
toHaveLength
(
0
)
})
it
(
'
author should see reviews only if recommendation has been made and only public ones
'
,
()
=>
{
const
{
fragment
}
=
testFixtures
.
fragments
fragment
.
recommendations
=
[
{
comments
:
[
{
content
:
'
private
'
,
public
:
false
,
},
{
content
:
'
public
'
,
public
:
true
,
},
],
},
]
const
result
=
ah
.
stripeFragmentByRole
({
fragment
,
role
:
'
author
'
,
status
:
'
revisionRequested
'
,
})
const
publicComments
=
get
(
result
,
'
recommendations[0].comments
'
)
expect
(
publicComments
).
toHaveLength
(
1
)
})
it
(
'
HE should not see unsubmitted recommendations
'
,
()
=>
{
const
{
fragment
}
=
testFixtures
.
fragments
fragment
.
recommendations
=
[
{
comments
:
[
{
content
:
'
private
'
,
public
:
false
,
},
{
content
:
'
public
'
,
public
:
true
,
},
],
},
]
const
{
recommendations
}
=
ah
.
stripeFragmentByRole
({
fragment
,
role
:
'
handlingEditor
'
,
})
expect
(
recommendations
).
toHaveLength
(
0
)
})
it
(
'
HE should see submitted recommendations
'
,
()
=>
{
const
{
fragment
}
=
testFixtures
.
fragments
fragment
.
recommendations
=
[
{
comments
:
[
{
content
:
'
private
'
,
public
:
false
,
},
{
content
:
'
public
'
,
public
:
true
,
},
],
submittedOn
:
1122333
,
},
]
const
{
recommendations
}
=
ah
.
stripeFragmentByRole
({
fragment
,
role
:
'
handlingEditor
'
,
})
expect
(
recommendations
).
toHaveLength
(
1
)
})
})
it
(
'
getUsersList - should return parsed users when the user is admin
'
,
async
()
=>
{
const
{
admin
}
=
testFixtures
.
users
const
parsedUsers
=
await
ah
.
getUsersList
({
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
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