'use strict';
import { ESLintUtils } from '@typescript-eslint/utils';
import { getMethodNameFromCallee, nodeTypes, isSimpleMemberExpression } from '@flint/infra/analysis';
import { ruleTypes, url } from '@flint/infra/constants/rules-meta';
import { flintRuleIdentifiers } from '@flint/infra/constants/shared-string-identifiers';
import { firstOrUndefined } from '../../../fd-toolbox/server/collections/single-funcs.js';

var __defProp=Object['defineProperty'],__name=(_0x1bbb66,_0x29514a)=>__defProp(_0x1bbb66,'name',{'value':_0x29514a,'configurable':!![]});const ruleName='must-name-ui-tests-component-condition-expected-result';const messageId='mustNameUiTestsComponentConditionExpectedResult',constants={'meta':{'type':ruleTypes['problem'],'docs':{'description':'Must\x20name\x20Ui\x20tests\x20Component\x20-\x20Condition\x20-\x20Expected\x20Result.'},'messages':{[messageId]:ruleName+'\x0a###\x20**Must**\x20name\x20Ui\x20tests\x20Component\x20-\x20Condition\x20-\x20Expected\x20Result.\x0a\x0aUI\x20test\x20names\x20should\x20follow\x20the\x20format:\x20\x22${Component.name}\x20-\x20…\x20-\x20…\x22.\x0a\x0a####\x20Wrong\x0a\x0atest(\x22Person\x20list\x20test\x22,\x20async\x20({\x20page,\x20baseURL\x20})\x20=>\x20{...});\x0a\x0a####\x20Correct\x0a\x0atest(\x0a\x20\x20\x20\x20`${ResourceList.name}\x20-\x20filtered\x20by\x20name\x20-\x20only\x20those\x20persons\x20appear\x20in\x20table`,\x0a\x20\x20\x20\x20…\x0a);\x0a\x0a//\x20no\x20condition\x0atest(`${ResourceList.name}\x20-\x20displays\x20list\x20of\x20persons`,\x20…);\x0a\x0a####\x20Why\x0a\x0aUsing\x20consistent\x20and\x20descriptive\x20tests\x20names\x20enhances\x20readability\x20and\x20understanding\x20of\x20the\x20test\x20purpose.'},'schema':[]}},createRule=ESLintUtils['RuleCreator'](_0x3e8e9b=>''+url+_0x3e8e9b),mustNameUiTestsComponentConditionExpectedResult=createRule({'name':ruleName,'meta':constants['meta'],'defaultOptions':[],'create'(_0xd074cf){return {'CallExpression'(_0x5526a6){shouldReportUiTestNameError(_0x5526a6)&&report(_0xd074cf,_0x5526a6);}};}});function isUiTest(_0x2f9f13){return getMethodNameFromCallee(_0x2f9f13['callee'])===flintRuleIdentifiers['uiTest']||getMethodNameFromCallee(_0x2f9f13['callee'],flintRuleIdentifiers['uiTest'])==='fixme';}__name(isUiTest,'isUiTest');function report(_0x13e483,_0x2ae0e3){_0x13e483['report']({'node':_0x2ae0e3,'messageId':messageId});}__name(report,'report');function isDash(_0x22b2b0){return _0x22b2b0['some'](_0x1a1ba8=>_0x1a1ba8['value']['cooked']['includes']('\x20-\x20'));}__name(isDash,'isDash');function shouldReportUiTestNameError(_0x541bf7){let _0x2c3e69=![];if(isUiTest(_0x541bf7)){const _0x31ca92=firstOrUndefined(_0x541bf7['arguments']);if(_0x31ca92&&_0x31ca92['type']===nodeTypes['templateLiteral']){const _0x518cc1=_0x31ca92['expressions']['some'](isSimpleMemberExpression);_0x2c3e69=!_0x518cc1||!isDash(_0x31ca92['quasis']);}else _0x2c3e69=!![];}return _0x2c3e69;}__name(shouldReportUiTestNameError,'shouldReportUiTestNameError');

export { mustNameUiTestsComponentConditionExpectedResult as default, ruleName };
