Fixed some instances of:
- Unordered imports
- Reassigning function parameters
- Modifying values in assignment/return statements
- Array.forEach being used instead of for...of
- Simplified control logic
- Updated to safely access a deeply nested property.
- Updated to safely access the item `_id` and `_name` properties in the warning log.
- Updated to use the `RandomUtil.getArrayValue()` method to select a random ammo item template ID.
- Finished up some tests.
- Adds the `date-fns-tz` module to dep.
- Moves the `date-fns` module from development dependancies to dependancies.
- Removes the depreciated `substr` method usage.
- Adds the `pad` method to handle padding time digits.
- Dates and times are now standardized UTC.
- Adds basic tests for all methods.
- Doesn't recreate the container for each test file, only loads the database once at the start, makes it much faster.
- Every test file should be imported in `Setup.test.ts` in order for it to work.
- Adds tests for the remaining methods in the `InsuranceController`.
- Adds a `countAllInsuranceItems()` method to the `InsuranceController`.
- Adds the Vitest UI and coverage packages.
- Updates the `profileInsuranceFactory` to use second-epoch dates instead of millisecond-epoch dates.
- Updates the `InsuranceController.fetchHideoutItemParent()` method to log a warning when an item with a slotId of 'hideout' cannot be found.
TODO:
- The Vitest coverage options are not working.
- Created profileInsurance test fixture.
- Created ProfileInsurance test factory class.
- Improved many of the InsuranceController method tests by utilizing the factory and fixture. Still some left to do here.
- Adds the `date-fns` package as a development dependancy for easy date manipulation.
- Cleaned up some comments.
Bug Fixes 🐞
- Resolved an issue where `ItemHelper.getAttachmentMainParent()` was not returning null when it should have.
- Resolved an issue where `InsuranceController.populateParentAttachmentsMap()` would continue to process when the parent could not be found.
- Adds tests for the majority of the methods within InsuranceController.
- Simplifies the `InsuranceController.sendMail()` method so that the toDelete parameter is no longer required.
- Modifies `InsuranceController.findItemsToDelete()` to only process regular and attachment items when they exist.
- Modifies `InsuranceController.rollForDelete()` to return null in the event that the provided Trader can not be found.
Adds a single test for the basic functionality of the `PaymentService.payMoney` method. It's huge. I hate it. It works. The entire class needs to be refactored to be more testable. Each of these methods should be split up to only have (ideally) a single responsibility--It has about 6 going on right now.
It was just too damn slow... 25+ seconds for *two*. Profile information will have to be partial-mocked using the sections and properties that the tested method will use, and casted as the parameter type (`IPmcData`, for example).
Basically the same, except it plays nicer with Typescript and ESM.
I have it mostly working, except for a type error:
`TypeError: Int32Array is not a constructor`
But I'm too damn tired it debug it at the moment.
- Adds additional ItemHelper tests
- Attempts to bring container registration into the environment to debug how we can register everything but not actually start the server.