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
d8a802fc
Commit
d8a802fc
authored
Mar 19, 2021
by
seotts
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test that status gets correctly set in constructor
parent
17441085
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
2 deletions
+31
-2
test/unit/components/compose-comment.test.jsx
test/unit/components/compose-comment.test.jsx
+31
-2
No files found.
test/unit/components/compose-comment.test.jsx
View file @
d8a802fc
...
@@ -51,6 +51,36 @@ describe('Compose Comment test', () => {
...
@@ -51,6 +51,36 @@ describe('Compose Comment test', () => {
return
wrapper
.
dive
();
// unwrap redux connect(injectIntl(ComposeComment))
return
wrapper
.
dive
();
// unwrap redux connect(injectIntl(ComposeComment))
};
};
test
(
'
status is EDITING when props do not contain a muteStatus
'
,
()
=>
{
const
commentInstance
=
getComposeCommentWrapper
({}).
instance
();
expect
(
commentInstance
.
state
.
status
).
toBe
(
'
EDITING
'
);
});
test
(
'
status is COMPOSE_DISALLOWED when props contain a future mute
'
,
()
=>
{
jest
.
useFakeTimers
();
const
realDateNow
=
Date
.
now
.
bind
(
global
.
Date
);
global
.
Date
.
now
=
()
=>
0
;
const
mutedStore
=
mockStore
({
session
:
{
session
:
{
user
:
{},
permissions
:
{
mute_status
:
{
muteExpiresAt
:
5
,
offenses
:
[],
showWarning
:
true
}
}
}
}
});
const
component
=
getComposeCommentWrapper
({},
mutedStore
);
const
commentInstance
=
component
.
instance
();
expect
(
commentInstance
.
state
.
status
).
toBe
(
'
COMPOSE_DISALLOWED
'
);
global
.
Date
.
now
=
realDateNow
;
});
test
(
'
Modal & Comment status do not show
'
,
()
=>
{
test
(
'
Modal & Comment status do not show
'
,
()
=>
{
const
component
=
getComposeCommentWrapper
({});
const
component
=
getComposeCommentWrapper
({});
// Comment compsoe box is there
// Comment compsoe box is there
...
@@ -176,7 +206,7 @@ describe('Compose Comment test', () => {
...
@@ -176,7 +206,7 @@ describe('Compose Comment test', () => {
expect
(
component
.
find
(
'
CommentingStatus
'
).
exists
()).
toEqual
(
true
);
expect
(
component
.
find
(
'
CommentingStatus
'
).
exists
()).
toEqual
(
true
);
global
.
Date
.
now
=
realDateNow
;
global
.
Date
.
now
=
realDateNow
;
});
});
test
(
'
Comment Status shows when user just submitted a reply comment that got them muted
'
,
()
=>
{
test
(
'
Comment Status shows when user just submitted a reply comment that got them muted
'
,
()
=>
{
const
realDateNow
=
Date
.
now
.
bind
(
global
.
Date
);
const
realDateNow
=
Date
.
now
.
bind
(
global
.
Date
);
global
.
Date
.
now
=
()
=>
0
;
global
.
Date
.
now
=
()
=>
0
;
...
@@ -360,7 +390,6 @@ describe('Compose Comment test', () => {
...
@@ -360,7 +390,6 @@ describe('Compose Comment test', () => {
expect
(
component
.
find
(
'
MuteModal
'
).
exists
()).
toEqual
(
true
);
expect
(
component
.
find
(
'
MuteModal
'
).
exists
()).
toEqual
(
true
);
expect
(
component
.
find
(
'
MuteModal
'
).
props
().
showFeedback
).
toBe
(
false
);
expect
(
component
.
find
(
'
MuteModal
'
).
props
().
showFeedback
).
toBe
(
false
);
});
});
test
(
'
shouldShowMuteModal is false when muteStatus is undefined
'
,
()
=>
{
test
(
'
shouldShowMuteModal is false when muteStatus is undefined
'
,
()
=>
{
const
commentInstance
=
getComposeCommentWrapper
({}).
instance
();
const
commentInstance
=
getComposeCommentWrapper
({}).
instance
();
expect
(
commentInstance
.
shouldShowMuteModal
()).
toBe
(
false
);
expect
(
commentInstance
.
shouldShowMuteModal
()).
toBe
(
false
);
...
...
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