react-code-dataset / wp-calypso /packages /eslint-plugin-wpcalypso /lib /util /test /sequence-callee.js
react-code-dataset / wp-calypso /packages /eslint-plugin-wpcalypso /lib /util /test /sequence-callee.js
Download wp-calypso/packages/eslint-plugin-wpcalypso/lib/util/test/sequence-callee.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.38 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/eslint-plugin-wpcalypso/lib/util/test/sequence-callee.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/packages/eslint-plugin-wpcalypso/lib/util/test/sequence-callee.js
-
curl -L -o sequence-callee.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/eslint-plugin-wpcalypso/lib/util/test/sequence-callee.js
1.38 kB
| /** | |
| * @file Utility for retrieving callee identifier node from a CallExpression | |
| * @author Automattic | |
| * @copyright 2016 Automattic. All rights reserved. | |
| * See LICENSE.md file in root directory for full license. | |
| */ | |
| const getCallee = require( '../get-callee' ); | |
| describe( '#getCallee', function () { | |
| it( 'should return non-sequence callee', function () { | |
| const node = { | |
| type: 'CallExpression', | |
| callee: { | |
| type: 'Identifier', | |
| name: 'translate', | |
| }, | |
| }; | |
| const callee = getCallee( node ); | |
| expect( callee ).toEqual( node.callee ); | |
| } ); | |
| it( 'should return first non-sequence callee expression', function () { | |
| const node = { | |
| type: 'CallExpression', | |
| callee: { | |
| type: 'SequenceExpression', | |
| expressions: [ | |
| { | |
| type: 'Literal', | |
| value: 0, | |
| }, | |
| { | |
| type: 'Identifier', | |
| name: 'translate', | |
| }, | |
| ], | |
| }, | |
| }; | |
| const callee = getCallee( node ); | |
| expect( callee ).toEqual( node.callee.expressions[ 1 ] ); | |
| } ); | |
| it( 'should return first non-sequence member property', function () { | |
| const node = { | |
| type: 'CallExpression', | |
| callee: { | |
| type: 'MemberExpression', | |
| object: { | |
| type: 'ThisExpression', | |
| }, | |
| property: { | |
| type: 'Identifier', | |
| value: 'translate', | |
| }, | |
| }, | |
| }; | |
| const callee = getCallee( node ); | |
| expect( callee ).toEqual( node.callee.property ); | |
| } ); | |
| } ); | |