Skip to content

Commit

Permalink
chore: Merge master to develop and manage conflict (#3570)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien2p authored Mar 29, 2023
1 parent 0695ff6 commit 7f120e5
Show file tree
Hide file tree
Showing 25 changed files with 1,020 additions and 370 deletions.
28 changes: 14 additions & 14 deletions integration-tests/api/__tests__/batch-jobs/product/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ describe("Product import batch job", () => {
ean: null,
upc: null,
inventory_quantity: 10,
prices: [
prices: expect.arrayContaining([
expect.objectContaining({
currency_code: "eur",
amount: 100,
Expand All @@ -198,7 +198,7 @@ describe("Product import batch job", () => {
amount: 130,
region_id: "region-product-import-1",
}),
],
]),
options: expect.arrayContaining([
expect.objectContaining({
value: "option 1 value red",
Expand All @@ -210,24 +210,24 @@ describe("Product import batch job", () => {
}),
],
type: null,
images: [
images: expect.arrayContaining([
expect.objectContaining({
url: "test-image.png",
}),
],
options: [
]),
options: expect.arrayContaining([
expect.objectContaining({
title: "test-option-1",
}),
expect.objectContaining({
title: "test-option-2",
}),
],
tags: [
]),
tags: expect.arrayContaining([
expect.objectContaining({
value: "123_1",
}),
],
]),
collection: expect.objectContaining({
handle: collectionHandle1,
}),
Expand All @@ -249,7 +249,7 @@ describe("Product import batch job", () => {
ean: null,
upc: null,
inventory_quantity: 10,
prices: [
prices: expect.arrayContaining([
expect.objectContaining({
currency_code: "eur",
amount: 100,
Expand All @@ -264,7 +264,7 @@ describe("Product import batch job", () => {
amount: 130,
region_id: "region-product-import-1",
}),
],
]),
options: expect.arrayContaining([
expect.objectContaining({
value: "option 1 value red",
Expand All @@ -276,19 +276,19 @@ describe("Product import batch job", () => {
}),
],
type: null,
images: [
images: expect.arrayContaining([
expect.objectContaining({
url: "test-image.png",
}),
],
options: [
]),
options: expect.arrayContaining([
expect.objectContaining({
title: "test-option-1",
}),
expect.objectContaining({
title: "test-option-2",
}),
],
]),
tags: [],
collection: expect.objectContaining({
handle: collectionHandle1,
Expand Down
2 changes: 1 addition & 1 deletion packages/inventory/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,4 @@

- Updated dependencies [[`9dbccd9ca`](https://github.com/medusajs/medusa/commit/9dbccd9ca78b8b66f9a21947bb863622e7ff326b), [`542daeead`](https://github.com/medusajs/medusa/commit/542daeeadd78d939f5144c690e8907374da6d085), [`8c08d0031`](https://github.com/medusajs/medusa/commit/8c08d003198b94c00f8428a51c0e79d2ca9d1dc7), [`017538883`](https://github.com/medusajs/medusa/commit/017538883588792e1ff37abcab0fd2872c9af932), [`b2839e2e4`](https://github.com/medusajs/medusa/commit/b2839e2e4dc0d9344fa2ac8d4d16b796def4c56d), [`76d175231`](https://github.com/medusajs/medusa/commit/76d17523105d3860028a90a45b6038a64040e5ce), [`9e3beaf53`](https://github.com/medusajs/medusa/commit/9e3beaf5319dc785cf84b856cfcc8193df90c3a4), [`7d4b8b9cc`](https://github.com/medusajs/medusa/commit/7d4b8b9cc59672d01cdf0c6f331bc3d1eeec9bee), [`aab163bab`](https://github.com/medusajs/medusa/commit/aab163babb91759a05b852d34c299cdfac96d800), [`a0c4cfe0f`](https://github.com/medusajs/medusa/commit/a0c4cfe0f74cf30c45956c32c2fb22bf833bea68), [`27a29ef24`](https://github.com/medusajs/medusa/commit/27a29ef24e5ea1ba2bc0be8ecb7dd747d4c7c65b), [`aef842123`](https://github.com/medusajs/medusa/commit/aef8421235d8fff68d7d4f8b73f77484073311a5), [`1dc79590b`](https://github.com/medusajs/medusa/commit/1dc79590b3539af09dbc8fbf931d9b5ee225fb0d), [`9c4647383`](https://github.com/medusajs/medusa/commit/9c4647383ebf0a183ccc566636bcf7af06409060), [`a0c4cfe0f`](https://github.com/medusajs/medusa/commit/a0c4cfe0f74cf30c45956c32c2fb22bf833bea68), [`b80124d32`](https://github.com/medusajs/medusa/commit/b80124d32d950790c2a01b49e8c34d562b1d57f4), [`cb1ec0076`](https://github.com/medusajs/medusa/commit/cb1ec0076b4fd932c686d6027e8b060ceded3a64), [`142c8aa70`](https://github.com/medusajs/medusa/commit/142c8aa70f583d9b11a6add2b8f988e9ba4cf979), [`1547dd814`](https://github.com/medusajs/medusa/commit/1547dd8143889fc30045fc3d0241de8e69acb76e), [`d2c692aa9`](https://github.com/medusajs/medusa/commit/d2c692aa96ea89c053f9a694a9ae6dba77e89b14), [`150696de9`](https://github.com/medusajs/medusa/commit/150696de99fc852c5d72a746f168b6f62b2086ed), [`93d0dc1bd`](https://github.com/medusajs/medusa/commit/93d0dc1bdcb54cf6e87428a7bb9b0dac196b4de2), [`b3e4be720`](https://github.com/medusajs/medusa/commit/b3e4be72087d0b528c3cce322edf9325b855c8ae)]:
- @medusajs/medusa@1.7.4
- [email protected]
- [email protected]
2 changes: 1 addition & 1 deletion packages/medusa-test-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,4 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### Bug Fixes

- updates license ([db519fb](https://github.com/medusajs/medusa/commit/db519fbaa6f8ad02c19cbecba5d4f28ba1ee81aa))
- updates license ([db519fb](https://github.com/medusajs/medusa/commit/db519fbaa6f8ad02c19cbecba5d4f28ba1ee81aa))
13 changes: 13 additions & 0 deletions packages/medusa-test-utils/src/mock-manager.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
export default {
connection: {
getMetadata: (target) => {

return target["metadata"] ?? {
columns: []
}
}
},

getRepository: function (repo) {
return repo
},

withRepository: function (repo) {
if (repo) {
return Object.assign(repo, { manager: this })
}

return repo
},

Expand Down
17 changes: 17 additions & 0 deletions packages/medusa-test-utils/src/mock-repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class MockRepo {
del,
count,
insertBulk,
metadata
}) {
this.create_ = create
this.update_ = update
Expand All @@ -28,6 +29,10 @@ class MockRepo {
this.findAndCount_ = findAndCount
this.findOneWithRelations_ = findOneWithRelations
this.insertBulk_ = insertBulk

this.metadata = metadata ?? {
columns: []
}
}

setFindOne(fn) {
Expand Down Expand Up @@ -83,11 +88,22 @@ class MockRepo {
return this.findDescendantsTree_(...args)
}
})
findOneOrFail = jest.fn().mockImplementation((...args) => {
if (this.findOneOrFail_) {
return this.findOneOrFail_(...args)
}
})

find = jest.fn().mockImplementation((...args) => {
if (this.find_) {
return this.find_(...args)
}
})
softRemove = jest.fn().mockImplementation((...args) => {
if (this.softRemove_) {
return this.softRemove_(...args)
}
})
save = jest.fn().mockImplementation((...args) => {
if (this.save_) {
return this.save_(...args)
Expand All @@ -107,6 +123,7 @@ class MockRepo {
}
return {}
})

delete = jest.fn().mockImplementation((...args) => {
if (this.delete_) {
return this.delete_(...args)
Expand Down
2 changes: 1 addition & 1 deletion packages/medusa/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2407,4 +2407,4 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### Bug Fixes

- updates license ([db519fb](https://github.com/medusajs/medusa/commit/db519fbaa6f8ad02c19cbecba5d4f28ba1ee81aa))
- updates license ([db519fb](https://github.com/medusajs/medusa/commit/db519fbaa6f8ad02c19cbecba5d4f28ba1ee81aa))
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("POST /admin/products/:id", () => {
description: "Updated test description",
handle: "handle",
variants: [
{ id: IdMap.getId("variant_1"), title: "Green" },
{ id: IdMap.getId("testVariant"), title: "Green" },
{ title: "Blue" },
{ title: "Yellow" },
],
Expand Down Expand Up @@ -48,7 +48,6 @@ describe("POST /admin/products/:id", () => {
})

it("successfully updates variants and create new ones", async () => {
expect(ProductVariantServiceMock.delete).toHaveBeenCalledTimes(2)
expect(ProductVariantServiceMock.update).toHaveBeenCalledTimes(1)
expect(ProductVariantServiceMock.create).toHaveBeenCalledTimes(2)
})
Expand All @@ -73,7 +72,7 @@ describe("POST /admin/products/:id", () => {
)
expect(subject.status).toEqual(404)
expect(subject.error.text).toEqual(
`{"type":"not_found","message":"Variant with id: test_321 is not associated with this product"}`
`{"type":"not_found","message":"Variants with id: test_321 are not associated with this product"}`
)
})
})
Expand Down
Loading

0 comments on commit 7f120e5

Please sign in to comment.