Files
formipay/node_modules/eslint-plugin-jest/docs/rules/no-conditional-in-test.md
dwindown e8fbfb14c1 fix: prevent asset conflicts between React and Grid.js versions
Add coexistence checks to all enqueue methods to prevent loading
both React and Grid.js assets simultaneously.

Changes:
- ReactAdmin.php: Only enqueue React assets when ?react=1
- Init.php: Skip Grid.js when React active on admin pages
- Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0
- Customer.php, Product.php, License.php: Add coexistence checks

Now the toggle between Classic and React versions works correctly.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 17:02:14 +07:00

82 lines
1.6 KiB
Markdown

# Disallow conditional logic in tests (`no-conditional-in-test`)
<!-- end auto-generated rule header -->
Conditional logic in tests is usually an indication that a test is attempting to
cover too much, and not testing the logic it intends to. Each branch of code
executing within a conditional statement will usually be better served by a test
devoted to it.
## Rule details
This rule reports on any use of a conditional statement such as `if`, `switch`,
and ternary expressions.
Examples of **incorrect** code for this rule:
```js
it('foo', () => {
if (true) {
doTheThing();
}
});
it('bar', () => {
switch (mode) {
case 'none':
generateNone();
case 'single':
generateOne();
case 'multiple':
generateMany();
}
expect(fixtures.length).toBeGreaterThan(-1);
});
it('baz', async () => {
const promiseValue = () => {
return something instanceof Promise
? something
: Promise.resolve(something);
};
await expect(promiseValue()).resolves.toBe(1);
});
```
Examples of **correct** code for this rule:
```js
describe('my tests', () => {
if (true) {
it('foo', () => {
doTheThing();
});
}
});
beforeEach(() => {
switch (mode) {
case 'none':
generateNone();
case 'single':
generateOne();
case 'multiple':
generateMany();
}
});
it('bar', () => {
expect(fixtures.length).toBeGreaterThan(-1);
});
const promiseValue = something => {
return something instanceof Promise ? something : Promise.resolve(something);
};
it('baz', async () => {
await expect(promiseValue()).resolves.toBe(1);
});
```