fix(medusa): Product repo typeorm issues (#4084)
* fix(medusa): Product repo typeorm issues * chore: fixed category scopes * WIP fix categories * fix product repo to attach categories * fix uni tests * Create eighty-icons-exercise.md * revert package.json * fix change set * last fixes * cleanup iteration * fix repository deep relations joining aliasing * improve response time * improve category test case * fix free texts search * fix repo * centralise repository manipulation into utils and use the utils in the product repo * fix product repo * fix customer group * update changeset * fix customer group * include feedback * fix repo * remove query strategy --------- Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
This commit is contained in:
committed by
GitHub
parent
26963acc0a
commit
9518efccae
@@ -1,27 +1,14 @@
|
||||
const path = require("path")
|
||||
const { ProductCategory } = require("@medusajs/medusa")
|
||||
const { DiscountRuleType, AllocationType } = require("@medusajs/medusa/dist")
|
||||
const { IdMap } = require("medusa-test-utils")
|
||||
const {
|
||||
ProductVariant,
|
||||
ProductOptionValue,
|
||||
MoneyAmount,
|
||||
DiscountConditionType,
|
||||
DiscountConditionOperator,
|
||||
} = require("@medusajs/medusa")
|
||||
|
||||
const setupServer = require("../../../../helpers/setup-server")
|
||||
const { useApi } = require("../../../../helpers/use-api")
|
||||
const { initDb, useDb } = require("../../../../helpers/use-db")
|
||||
const adminSeeder = require("../../../helpers/admin-seeder")
|
||||
const productSeeder = require("../../../helpers/product-seeder")
|
||||
const priceListSeeder = require("../../../helpers/price-list-seeder")
|
||||
const {
|
||||
simpleProductFactory,
|
||||
simpleDiscountFactory,
|
||||
simpleProductCategoryFactory,
|
||||
simpleSalesChannelFactory,
|
||||
simpleRegionFactory,
|
||||
} = require("../../../factories")
|
||||
|
||||
const testProductId = "test-product"
|
||||
@@ -124,10 +111,7 @@ describe("/admin/products [MEDUSA_FF_PRODUCT_CATEGORIES=true]", () => {
|
||||
it("returns a list of products in product category without category children", async () => {
|
||||
const api = useApi()
|
||||
const params = `category_id[]=${categoryWithProductId}`
|
||||
const response = await api.get(
|
||||
`/admin/products?${params}`,
|
||||
adminHeaders
|
||||
)
|
||||
const response = await api.get(`/admin/products?${params}`, adminHeaders)
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.products).toHaveLength(1)
|
||||
@@ -141,10 +125,7 @@ describe("/admin/products [MEDUSA_FF_PRODUCT_CATEGORIES=true]", () => {
|
||||
it("returns a list of products in product category without category children explicitly set to false", async () => {
|
||||
const api = useApi()
|
||||
const params = `category_id[]=${categoryWithProductId}&include_category_children=false`
|
||||
const response = await api.get(
|
||||
`/admin/products?${params}`,
|
||||
adminHeaders
|
||||
)
|
||||
const response = await api.get(`/admin/products?${params}`, adminHeaders)
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.products).toHaveLength(1)
|
||||
@@ -159,10 +140,7 @@ describe("/admin/products [MEDUSA_FF_PRODUCT_CATEGORIES=true]", () => {
|
||||
const api = useApi()
|
||||
|
||||
const params = `category_id[]=${categoryWithProductId}&include_category_children=true`
|
||||
const response = await api.get(
|
||||
`/admin/products?${params}`,
|
||||
adminHeaders
|
||||
)
|
||||
const response = await api.get(`/admin/products?${params}`, adminHeaders)
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.products).toHaveLength(3)
|
||||
@@ -185,10 +163,7 @@ describe("/admin/products [MEDUSA_FF_PRODUCT_CATEGORIES=true]", () => {
|
||||
const api = useApi()
|
||||
|
||||
const params = `category_id[]=${categoryWithoutProductId}&include_category_children=true`
|
||||
const response = await api.get(
|
||||
`/admin/products?${params}`,
|
||||
adminHeaders
|
||||
)
|
||||
const response = await api.get(`/admin/products?${params}`, adminHeaders)
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.products).toHaveLength(0)
|
||||
|
||||
Reference in New Issue
Block a user