feat: Implement missing methods in product module and make more tests pass (#6650)

The 2 bigger remaining tasks are:
1. handling prices for variants
2. Handling options (breaking change)

After that all tests should pass on both v1 and v2
This commit is contained in:
Stevche Radevski
2024-03-11 11:03:24 +00:00
committed by GitHub
parent e124762873
commit ff4bd62f71
29 changed files with 1194 additions and 321 deletions
@@ -294,7 +294,7 @@ describe("ProductModuleService product collections", () => {
it("should emit events through event bus", async () => {
const eventBusSpy = jest.spyOn(EventBusService.prototype, "emit")
await service.updateCollections([
await service.upsertCollections([
{
id: collectionId,
title: "New Collection",
@@ -311,7 +311,7 @@ describe("ProductModuleService product collections", () => {
})
it("should update the value of the collection successfully", async () => {
await service.updateCollections([
await service.upsertCollections([
{
id: collectionId,
title: "New Collection",
@@ -324,7 +324,7 @@ describe("ProductModuleService product collections", () => {
})
it("should add products to a collection successfully", async () => {
await service.updateCollections([
await service.upsertCollections([
{
id: collectionId,
product_ids: [productOne.id, productTwo.id],
@@ -355,7 +355,7 @@ describe("ProductModuleService product collections", () => {
let error
try {
await service.updateCollections([
await service.upsertCollections([
{
id: "does-not-exist",
title: "New Collection",
@@ -18,6 +18,8 @@ import { buildProductAndRelationsData } from "../../../__fixtures__/product/data
import { DB_URL, TestDatabase, getInitModuleConfig } from "../../../utils"
import { UpdateProductInput } from "../../../../src/types/services/product"
jest.setTimeout(30000)
const beforeEach_ = async () => {
await TestDatabase.setupDatabase()
return await TestDatabase.forkManager()