OBPIH-6969 Improve approach to product creation and stock data #61
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The main idea of this improvement is to simplify adding new products and inventories. Current solution doesn't require adding new data in env, app config, etc. To create a new product or inventory, it is needed to fulfill the CSV that can be found in
src/setup/dataImport
. The data is loaded on every setup before running tests. If there will be a need to remove inventories or import other products while running specific tests, it is needed to create a new CSV file (for inventories with 0 qty, if removing) and call the endpoint that is called during setup. ID of every product that was created can be found in.data.json
, so it's accessible by product code using helper methods that were created previously. Product data is also accessible from the AppConfig, but to get the specific that, there is a need to pass the product code. At this moment,productService
is exactly the same service for every product. To change the product on which all of the operations will be executed, you should callsetProduct
and pass the product code.