Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
e66a31ab
Commit
e66a31ab
authored
Jun 30, 2021
by
Paul Kaplan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(studios): add missing test situations for studio-member-actions
parent
caeb6e47
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
test/unit/redux/studio-member-actions.test.js
test/unit/redux/studio-member-actions.test.js
+26
-0
No files found.
test/unit/redux/studio-member-actions.test.js
View file @
e66a31ab
...
...
@@ -175,6 +175,25 @@ describe('removeManager', () => {
expect
(
state
.
studio
.
manager
).
toBe
(
false
);
});
test
(
'
removing a manager that hasnt been loaded yet still works
'
,
async
()
=>
{
// This covers an edge case the code allows where you can remove a manager
// even if that manager hasn't been loaded into the paginated managers state yet.
api
.
mockImplementation
((
opts
,
callback
)
=>
{
callback
(
null
,
{},
{
statusCode
:
200
});
// Server says that manager was removed
});
await
store
.
dispatch
(
removeManager
(
'
user4
'
));
const
state
=
store
.
getState
();
// Manager count should still be updated
expect
(
selectStudioManagerCount
(
state
)).
toBe
(
98
);
// The removed manager isn't the current user, so manager permission should be unchanged
expect
(
state
.
studio
.
manager
).
toBe
(
false
);
// No change to the manager items list
expect
(
managers
.
selector
(
state
).
items
.
length
).
toBe
(
1
);
expect
(
managers
.
selector
(
state
).
items
[
0
].
username
).
toBe
(
'
user1
'
);
});
test
(
'
on error, promise rejects without any changing count or list
'
,
async
()
=>
{
api
.
mockImplementation
((
opts
,
callback
)
=>
{
callback
(
null
,
{},
{
statusCode
:
403
});
...
...
@@ -266,6 +285,13 @@ describe('inviteCurator', () => {
await
expect
(
store
.
dispatch
(
inviteCurator
(
'
user2
'
)))
.
rejects
.
toBe
(
Errors
.
DUPLICATE
);
});
test
(
'
error because of rate limit
'
,
async
()
=>
{
api
.
mockImplementation
((
opts
,
callback
)
=>
{
callback
(
null
,
null
,
{
statusCode
:
429
});
});
await
expect
(
store
.
dispatch
(
inviteCurator
(
'
user2
'
)))
.
rejects
.
toBe
(
Errors
.
RATE_LIMIT
);
});
test
(
'
unhandled error response
'
,
async
()
=>
{
api
.
mockImplementation
((
opts
,
callback
)
=>
{
callback
(
null
,
{
status
:
'
error
'
,
message
:
'
xyz
'
},
{
statusCode
:
200
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment