@@ -1,12 +1,12 @@
|
||||
import { SqlEntityManager } from "@mikro-orm/postgresql"
|
||||
|
||||
import { ProductCategoryService } from "@services"
|
||||
import { ProductCategoryRepository } from "@repositories"
|
||||
import { ProductCategory } from "@models"
|
||||
import { ProductCategoryRepository } from "@repositories"
|
||||
import { ProductCategoryService } from "@services"
|
||||
|
||||
import { TestDatabase } from "../../../utils"
|
||||
import { createProductCategories } from "../../../__fixtures__/product-category"
|
||||
import { productCategoriesData } from "../../../__fixtures__/product-category/data"
|
||||
import { TestDatabase } from "../../../utils"
|
||||
|
||||
jest.setTimeout(30000)
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { SqlEntityManager } from "@mikro-orm/postgresql"
|
||||
|
||||
import { ProductCollection } from "@models"
|
||||
import { ProductCollectionService } from "@services"
|
||||
import { ProductCollectionRepository } from "@repositories"
|
||||
import { ProductCollectionService } from "@services"
|
||||
|
||||
import { TestDatabase } from "../../../utils"
|
||||
import { createCollections } from "../../../__fixtures__/product"
|
||||
import { TestDatabase } from "../../../utils"
|
||||
|
||||
jest.setTimeout(30000)
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { SqlEntityManager } from "@mikro-orm/postgresql"
|
||||
|
||||
import { ProductTagService } from "@services"
|
||||
import { ProductTagRepository } from "@repositories"
|
||||
import { Product } from "@models"
|
||||
import { ProductTagRepository } from "@repositories"
|
||||
import { ProductTagService } from "@services"
|
||||
|
||||
import { TestDatabase } from "../../../utils"
|
||||
import { createProductAndTags } from "../../../__fixtures__/product"
|
||||
import { ProductTypes } from "@medusajs/types"
|
||||
import { createProductAndTags } from "../../../__fixtures__/product"
|
||||
import { TestDatabase } from "../../../utils"
|
||||
|
||||
jest.setTimeout(30000)
|
||||
|
||||
|
||||
@@ -280,18 +280,15 @@ describe("ProductVariant Service", () => {
|
||||
expect.objectContaining({
|
||||
id: productVariantTestOne,
|
||||
title: "variant 1",
|
||||
}),
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
it("should return requested attributes when requested through config", async () => {
|
||||
const result = await service.retrieve(
|
||||
variantOne.id,
|
||||
{
|
||||
select: ["id", "title", "product.title"] as any,
|
||||
relations: ["product"],
|
||||
}
|
||||
)
|
||||
const result = await service.retrieve(variantOne.id, {
|
||||
select: ["id", "title", "product.title"] as any,
|
||||
relations: ["product"],
|
||||
})
|
||||
|
||||
expect(result).toEqual(
|
||||
expect.objectContaining({
|
||||
@@ -302,7 +299,7 @@ describe("ProductVariant Service", () => {
|
||||
id: "product-1",
|
||||
title: "product 1",
|
||||
}),
|
||||
}),
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
@@ -315,7 +312,9 @@ describe("ProductVariant Service", () => {
|
||||
error = e
|
||||
}
|
||||
|
||||
expect(error.message).toEqual("ProductVariant with id: does-not-exist was not found")
|
||||
expect(error.message).toEqual(
|
||||
"ProductVariant with id: does-not-exist was not found"
|
||||
)
|
||||
})
|
||||
|
||||
it("should throw an error when an id is not provided", async () => {
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
import { TestDatabase } from "../../../utils"
|
||||
import { ProductService } from "@services"
|
||||
import { ProductRepository } from "@repositories"
|
||||
import { Image, Product, ProductCategory, ProductVariant } from "@models"
|
||||
import { SqlEntityManager } from "@mikro-orm/postgresql"
|
||||
import { ProductDTO } from "@medusajs/types"
|
||||
|
||||
import { createProductCategories } from "../../../__fixtures__/product-category"
|
||||
import {
|
||||
assignCategoriesToProduct,
|
||||
createImages,
|
||||
@@ -17,7 +10,14 @@ import {
|
||||
productsData,
|
||||
variantsData,
|
||||
} from "../../../__fixtures__/product/data"
|
||||
|
||||
import { ProductDTO } from "@medusajs/types"
|
||||
import { ProductRepository } from "@repositories"
|
||||
import { ProductService } from "@services"
|
||||
import { SqlEntityManager } from "@mikro-orm/postgresql"
|
||||
import { TestDatabase } from "../../../utils"
|
||||
import { buildProductOnlyData } from "../../../__fixtures__/product/data/create-product"
|
||||
import { createProductCategories } from "../../../__fixtures__/product-category"
|
||||
import { kebabCase } from "@medusajs/utils"
|
||||
|
||||
jest.setTimeout(30000)
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import { ProductServiceInitializeOptions } from "../../src/types"
|
||||
|
||||
export const databaseOptions: ProductServiceInitializeOptions["database"] = {
|
||||
schema: "public",
|
||||
clientUrl: "medusa-products-test",
|
||||
}
|
||||
Reference in New Issue
Block a user