Skip to content

OBPIH-6969 Improve approach to product creation and stock data - #61

Merged
awalkowiak merged 12 commits into
mainfrom
OBPIH-6969
Oct 15, 2025
Merged

awalkowiak merged 12 commits into
mainfrom
OBPIH-6969

Conversation

@alannadolny

@alannadolny alannadolny commented Sep 5, 2025 •

Copy link
Copy Markdown
Collaborator

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 call setProduct and pass the product code.

@awalkowiak awalkowiak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it looks ok, maybe I would think next how to improve these lines:|

productService.setProduct('1');
const PRODUCT_ONE = await productService.getProduct();
productService.setProduct('2');
const PRODUCT_TWO = await productService.getProduct();

to just have a list or something, but for now we could go with what you have.

@awalkowiak
awalkowiak merged commit a973e09 into main Oct 15, 2025
1 check passed
@awalkowiak
awalkowiak deleted the OBPIH-6969 branch October 15, 2025 15:19
alannadolny added a commit that referenced this pull request Oct 20, 2025
awalkowiak pushed a commit that referenced this pull request Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants