'use strict';
import { ESLintUtils } from '@typescript-eslint/utils';
import { nodeTypes } from '@flint/infra/analysis';
import { ruleTypes, url } from '@flint/infra/constants/rules-meta';
import { flintRuleIdentifiers } from '@flint/infra/constants/shared-string-identifiers';

var __defProp=Object['defineProperty'],__name=(_0x32996e,_0x1ff054)=>__defProp(_0x32996e,'name',{'value':_0x1ff054,'configurable':!![]});const ruleName='no-use-conditional-logic-in-test-assertions';const ruleConstants={'messageId':'noUseConditionalLogicInTestAssertion','url':url,'meta':{'type':ruleTypes['problem'],'docs':{'description':'Disallow\x20using\x20conditional\x20logic\x20in\x20test\x20assertions.'},'messages':{'noUseConditionalLogicInTestAssertion':'no-use-conditional-logic-in-test-assertions\x0a###\x20**Must\x20not**\x20use\x20conditional\x20logic\x20in\x20test\x20assertions.\x0a\x0a####\x20Wrong\x0a\x0aawait\x20tablePo.assertBoolCellValue(\x0a\x20\x20\x20\x20person.areKidsVaccinated\x20??\x20false,\x0a\x20\x20\x20\x20rowIndex,\x0a\x20\x20\x20\x20resourceProps.areKidsVaccinated\x0a);\x0a\x0a####\x20Correct\x0a\x0aawait\x20tablePo.assertBoolCellValue(\x0a\x20\x20\x20\x20person.areKidsVaccinated,\x0a\x20\x20\x20\x20rowIndex,\x0a\x20\x20\x20\x20resourceProps.areKidsVaccinated\x0a);\x0a\x0a####\x20Why\x0a\x0aTests\x20should\x20have\x20clear,\x20deterministic\x20expectations.\x20Using\x20conditionals\x20in\x20assertions\x20makes\x20tests\x20harder\x20to\x20understand\x20and\x20can\x20hide\x20bugs.'},'schema':[]},'assertionNames':{'expect':'expect','assert':flintRuleIdentifiers['assert']}},createRule=ESLintUtils['RuleCreator'](_0x18887c=>''+ruleConstants['url']+_0x18887c),noUseConditionalLogicInTestAssertion=createRule({'name':ruleName,'meta':ruleConstants['meta'],'defaultOptions':[],'create'(_0x4a6370){return {'ExpressionStatement'(_0x59375b){checkAssertion(_0x4a6370,_0x59375b);}};}});function hasConditionalArgument(_0x43596a){return _0x43596a['some'](_0x17d153=>_0x17d153['type']===nodeTypes['conditionalExpression']||_0x17d153['type']===nodeTypes['logicalExpression']);}__name(hasConditionalArgument,'hasConditionalArgument');function reportIfConditionalInArguments(_0x433af0,_0x5668a0,_0x2cb1b7,_0x5ab54e){_0x2cb1b7&&_0x2cb1b7['length']>0x2*0x7f3+-0x46*-0x12+-0x14d2&&hasConditionalArgument(_0x2cb1b7)&&shouldReport(_0x433af0,_0x5668a0),_0x5ab54e&&_0x5ab54e['length']>0x4e*-0x4a+0x1f4b+-0x8bf&&hasConditionalArgument(_0x5ab54e)&&shouldReport(_0x433af0,_0x5668a0);}__name(reportIfConditionalInArguments,'reportIfConditionalInArguments');function isAssertionArguments(_0x27ceed,_0x5b407b,_0x3aeafe,_0x5e708e){if(_0x27ceed['object']['type']!==nodeTypes['callExpression'])return;_0x27ceed['object']['callee']['type']===nodeTypes['identifier']&&_0x27ceed['object']['callee']['name']===ruleConstants['assertionNames']['expect']&&reportIfConditionalInArguments(_0x3aeafe,_0x5e708e,_0x5b407b,_0x27ceed['object']['arguments']),_0x27ceed['object']['callee']['type']===nodeTypes['memberExpression']&&_0x27ceed['object']['callee']['property']['type']===nodeTypes['identifier']&&_0x27ceed['object']['callee']['property']['name']['startsWith'](ruleConstants['assertionNames']['assert'])&&reportIfConditionalInArguments(_0x3aeafe,_0x5e708e,_0x5b407b,_0x27ceed['object']['arguments']);}__name(isAssertionArguments,'isAssertionArguments');function isNodeCalleePropAssertion(_0x42e437,_0x4b001f){return _0x42e437['property']['type']===nodeTypes['identifier']&&_0x42e437['property']['name']['startsWith'](ruleConstants['assertionNames']['assert'])&&hasConditionalArgument(_0x4b001f);}__name(isNodeCalleePropAssertion,'isNodeCalleePropAssertion');function checkAssertion(_0x5de32e,_0x1fe719){const _0x5557b9=_0x1fe719['expression'];let _0x1a8e79,_0x3a1810;_0x5557b9['type']===nodeTypes['awaitExpression']&&_0x5557b9['argument']['type']===nodeTypes['callExpression']&&_0x5557b9['argument']['arguments']['length']>0x32f*-0x1+-0x10ff+0x142e&&_0x5557b9['argument']['callee']['type']===nodeTypes['memberExpression']&&(_0x1a8e79=_0x5557b9['argument']['callee'],_0x3a1810=_0x5557b9['argument']['arguments']);_0x5557b9['type']===nodeTypes['callExpression']&&_0x5557b9['arguments']['length']>0x4a7+-0x1607*-0x1+0x2ab*-0xa&&(_0x5557b9['callee']['type']===nodeTypes['memberExpression']&&(_0x1a8e79=_0x5557b9['callee'],_0x3a1810=_0x5557b9['arguments']),_0x5557b9['callee']['type']===nodeTypes['identifier']&&_0x5557b9['callee']['name']===ruleConstants['assertionNames']['expect']&&hasConditionalArgument(_0x5557b9['arguments'])&&shouldReport(_0x5de32e,_0x1fe719));if(!_0x1a8e79||!_0x3a1810)return;isAssertionArguments(_0x1a8e79,_0x3a1810,_0x5de32e,_0x1fe719);if(isNodeCalleePropAssertion(_0x1a8e79,_0x3a1810))shouldReport(_0x5de32e,_0x1fe719);}__name(checkAssertion,'checkAssertion');function shouldReport(_0x20ba55,_0x19ef3b){_0x20ba55['report']({'node':_0x19ef3b,'messageId':ruleConstants['messageId']});}__name(shouldReport,'shouldReport');

export { noUseConditionalLogicInTestAssertion as default, ruleName };
