mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 09:35:56 -05:00
Add test of shoudShowMuteModal when isReply
This commit is contained in:
parent
5d7d1cde3d
commit
1744108570
1 changed files with 19 additions and 1 deletions
|
@ -458,7 +458,25 @@ describe('Compose Comment test', () => {
|
||||||
global.Date.now = realDateNow;
|
global.Date.now = realDateNow;
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getMuteModalStartStep: not a reply ', () => {
|
test('shouldShowMuteModal is true when the user is already muted if the comment is a reply', () => {
|
||||||
|
const realDateNow = Date.now.bind(global.Date);
|
||||||
|
global.Date.now = () => 0;
|
||||||
|
// Since Date.now mocked to 0 above, we just need a small number to make
|
||||||
|
// it look like it was created < 2 minutes ago.
|
||||||
|
const offense = {
|
||||||
|
expiresAt: '1000',
|
||||||
|
createdAt: '-60' // ~1 ago min given shouldShowMuteModal's conversions,
|
||||||
|
};
|
||||||
|
const muteStatus = {
|
||||||
|
offenses: [offense]
|
||||||
|
};
|
||||||
|
const justMuted = false;
|
||||||
|
const commentInstance = getComposeCommentWrapper({isReply: true}).instance();
|
||||||
|
expect(commentInstance.shouldShowMuteModal(muteStatus, justMuted)).toBe(true);
|
||||||
|
global.Date.now = realDateNow;
|
||||||
|
});
|
||||||
|
|
||||||
|
test('getMuteModalStartStep: not a reply', () => {
|
||||||
const commentInstance = getComposeCommentWrapper({}).instance();
|
const commentInstance = getComposeCommentWrapper({}).instance();
|
||||||
expect(commentInstance.getMuteModalStartStep()).toBe(0);
|
expect(commentInstance.getMuteModalStartStep()).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue