Download wp-calypso/client/state/selectors/test/get-active-reply-comment-id.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 807 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/selectors/test/get-active-reply-comment-id.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/selectors/test/get-active-reply-comment-id.js
-
curl -L -o get-active-reply-comment-id.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/selectors/test/get-active-reply-comment-id.js
807 Bytes
| 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 ); | |
| } ); | |
| } ); | |