5 Commits

Author SHA1 Message Date
vchikalkin
9118a2d9ab refactor(orders): streamline order creation logic and enhance test setup
- Removed redundant variable assignments in the createOrder method for cleaner code.
- Updated test setup in orders.test.js to use global mocks for user and service retrieval, improving test clarity and maintainability.
- Added checks for required fields in order creation to ensure data integrity.
2025-08-11 16:05:55 +03:00
vchikalkin
b8ebdb8c64 fix(orders): update datetime validation logic and test cases for order creation and completion
- Modified order creation tests to set datetime_start to one hour in the past for past orders.
- Updated the OrdersService to use isNowOrAfter for validating order completion against the start time.
- Enhanced datetime utility function to accept a unit parameter for more flexible comparisons.
2025-08-11 14:56:45 +03:00
vchikalkin
269dabe067 feat(orders): implement updateOrder functionality with comprehensive validation tests
- Added updateOrder method in OrdersService with checks for permissions, order state, and datetime validation.
- Implemented tests for various scenarios including successful updates, permission errors, and validation failures.
- Enhanced error handling for overlapping time and invalid state changes.
- Updated GraphQL operations to support sorting in GetOrders query.
2025-08-11 14:38:33 +03:00
vchikalkin
5451fe79ed test(orders): add validation test for missing datetime_end in order creation 2025-08-06 15:19:07 +03:00
vchikalkin
f7c21d5c01 add orders.test.js 2025-08-06 15:06:01 +03:00