/* eslint-disable prettier/prettier */ import { AccessorPairs as $Rule, AccessorPairsOptions } from './accessor-pairs'; import { Envs, EsLintBestPracticesRules as Rules, Severity, } from '../../../enums'; import { RuleValue, isRule } from '../../../types'; const { AccessorPairs: $AccessorPairs } = Rules; describe(`${$AccessorPairs}`, (): void => { const key = $AccessorPairs; let env: Envs | undefined; let rule: RuleValue | undefined; let severity: Severity | undefined; let options: AccessorPairsOptions | undefined; describe('when environment is development', (): void => { beforeEach((): void => { env = Envs.dev; rule = $Rule[env][key] || $Rule[key]; ([severity, options] = rule); }); it('should have the correct rule', (): void => { expect(isRule(rule, key)).toBe(true); }); it('should be discouraged', (): void => { expect(severity).toBe(Severity.warn); }); it('should use the default options', (): void => { expect(options).toBeUndefined(); }); }); describe('when environment is production', (): void => { beforeEach((): void => { env = Envs.prod; rule = $Rule[env][key] || $Rule[key]; ([severity, options] = rule); }); it('should have the correct rule', (): void => { expect(isRule(rule, $AccessorPairs)).toBe(true); }); it('should be disabled', (): void => { expect(severity).toBe(Severity.off); }); it('should use the default options', (): void => { expect(options).toBeUndefined(); }); }); });