File size: 807 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { getActiveReplyCommentId } from 'calypso/state/comments/selectors';

describe( 'getActiveReplyCommentId()', () => {
	test( 'should return the active reply comment ID for a known site and post', () => {
		const prevState = {
			comments: {
				activeReplies: {
					'1-2': 124,
				},
			},
		};
		const siteId = 1;
		const postId = 2;
		const nextState = getActiveReplyCommentId( { state: prevState, siteId, postId } );
		expect( nextState ).toEqual( 124 );
	} );

	test( 'should return null for an unknown site and post', () => {
		const prevState = {
			comments: {
				activeReplies: {
					'1-2': 124,
				},
			},
		};
		const siteId = 1;
		const postId = 3;
		const nextState = getActiveReplyCommentId( { state: prevState, siteId, postId } );
		expect( nextState ).toEqual( null );
	} );
} );