Skip to content

Commit

Permalink
test(DEVX-358): add integration tests and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lojzatran committed May 13, 2024
1 parent 30d3ac5 commit ea287ea
Show file tree
Hide file tree
Showing 14 changed files with 365 additions and 165 deletions.
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ module.exports = {
]
: null,
].filter(Boolean),
setupFilesAfterEnv: ['jest-extended/all'],
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"husky": "^8.0.0",
"ignore-loader": "^0.1.2",
"jest": "29.7.0",
"jest-extended": "^4.0.2",
"jest-junit": "16.0.0",
"jest-watch-typeahead": "2.2.2",
"lint-staged": "13.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export type ClientResponse<T = any> = {
body: T
statusCode?: number
headers?: Object
originalRequest?: ClientRequest
}

export type executeRequest = (request: ClientRequest) => Promise<ClientResponse>
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ export const createProduct = async (productDraft) => {
return await apiRoot.products().post({ body: productDraft }).execute()
}

export const fetchAndDeleteProduct = async (productId: string) => {
const productGetResponse = await apiRoot
.products()
.withId({ ID: productId })
.get()
.execute()

return await deleteProduct(productGetResponse)
}

export const deleteProduct = async (product) => {
let updateProduct: ClientResponse<Product>
if (product.body?.masterData?.published) {
Expand Down

This file was deleted.

Loading

0 comments on commit ea287ea

Please sign in to comment.