Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: calculate logic arrX LogicOperator #84

Merged
merged 5 commits into from
Jan 18, 2025
Merged

Conversation

iugo
Copy link
Member

@iugo iugo commented Jan 18, 2025

为了加强功能

iugo added 5 commits January 18, 2025 16:59
- Introduced the `arrIntersect` operator in `LogicOperator` to evaluate if any items in one array exist in another.
- Enhanced the `logicCalculate` function to support the new `arrIntersect` operator, allowing for array intersection logic.
- Added unit tests in `calculate-logic.test.ts` to validate the functionality of the `arrIntersect` operator with various scenarios, including matching and non-matching cases.
…oint operator

- Updated the `LogicOperator` enum to rename `arrIntersect` to `arrIntersecting` for clarity.
- Introduced a new `arrDisjoint` operator to evaluate if two arrays have no common elements.
- Modified the `logicCalculate` function to implement the new `arrDisjoint` logic.
- Renamed the test case for array intersection to `test-arrIntersecting` and added a new test suite `test-arrDisjoint` to validate the functionality of the `arrDisjoint` operator with various scenarios.
- Refactored test cases in `calculate-logic.test.ts` to use a unified `skus` field instead of separate `skuWhiteList` and `skuBlackList` fields.
- Enhanced test descriptions for clarity, specifying scenarios for array intersection and disjoint operations.
- Added new tests for array intersection and disjoint logic, ensuring comprehensive coverage of matching and non-matching cases.
- Introduced a new `arrContains` operator in the `LogicOperator` enum to evaluate if all items in one array are present in another.
- Updated the `logicCalculate` function to implement the `arrContains` logic.
- Added comprehensive unit tests in `calculate-logic.test.ts` to validate the functionality of the `arrContains` operator, covering various scenarios including complete inclusion, partial inclusion, and non-inclusion cases.
- Added `isInvalid` operator to the `LogicOperator` enum to evaluate if a value is null, undefined, or an empty string.
- Updated the `fieldItemCalculate` function to support the new `isInvalid` operator alongside existing operators.
- Refactored the `getContrast` function to improve type handling for rule values.
- Expanded unit tests in `calculate-logic.test.ts` to cover various scenarios for the new `isInvalid` operator, including cases for empty data and logical combinations with `OR` and `AND` conditions.
@iugo iugo added the enhancement New feature or request label Jan 18, 2025
@iugo iugo self-assigned this Jan 18, 2025
@iugo iugo merged commit 7abfa58 into main Jan 18, 2025
1 check passed
@iugo iugo deleted the feat-calculate-logic-arr branch January 18, 2025 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant