chore(medusa): Typeorm upgrade to 0.3.11 (#3041)
This commit is contained in:
@@ -302,7 +302,8 @@ describe("Inventory Items endpoints", () => {
|
||||
|
||||
const response = await api.get(`/admin/inventory-items`, adminHeaders)
|
||||
|
||||
expect(response.data.inventory_items).toEqual([
|
||||
expect(response.data.inventory_items).toHaveLength(1)
|
||||
expect(response.data.inventory_items[0]).toEqual(
|
||||
expect.objectContaining({
|
||||
id: inventoryItemId,
|
||||
sku: "MY_SKU",
|
||||
@@ -359,8 +360,8 @@ describe("Inventory Items endpoints", () => {
|
||||
available_quantity: 5,
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
])
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
it("When deleting an inventory item it removes the product variants associated to it", async () => {
|
||||
|
||||
+15
-1
@@ -98,6 +98,7 @@ Object {
|
||||
"title": "Practical Granite Pizza",
|
||||
"upc": null,
|
||||
"updated_at": Any<Date>,
|
||||
"variant_rank": 0,
|
||||
"weight": null,
|
||||
"width": null,
|
||||
},
|
||||
@@ -254,6 +255,7 @@ Object {
|
||||
"title": "Practical Granite Pizza",
|
||||
"upc": null,
|
||||
"updated_at": Any<Date>,
|
||||
"variant_rank": 0,
|
||||
"weight": null,
|
||||
"width": null,
|
||||
},
|
||||
@@ -407,6 +409,7 @@ Object {
|
||||
"title": "Practical Granite Pizza",
|
||||
"upc": null,
|
||||
"updated_at": Any<Date>,
|
||||
"variant_rank": 0,
|
||||
"weight": null,
|
||||
"width": null,
|
||||
},
|
||||
@@ -525,6 +528,7 @@ Object {
|
||||
"title": "Practical Granite Pizza",
|
||||
"upc": null,
|
||||
"updated_at": Any<Date>,
|
||||
"variant_rank": 0,
|
||||
"weight": null,
|
||||
"width": null,
|
||||
},
|
||||
@@ -709,6 +713,7 @@ Object {
|
||||
"title": "Practical Granite Pizza",
|
||||
"upc": null,
|
||||
"updated_at": Any<Date>,
|
||||
"variant_rank": 0,
|
||||
"weight": null,
|
||||
"width": null,
|
||||
},
|
||||
@@ -875,6 +880,7 @@ Object {
|
||||
"title": "Practical Granite Pizza",
|
||||
"upc": null,
|
||||
"updated_at": Any<Date>,
|
||||
"variant_rank": 0,
|
||||
"weight": null,
|
||||
"width": null,
|
||||
},
|
||||
@@ -1130,6 +1136,7 @@ Object {
|
||||
"title": "Practical Granite Pizza",
|
||||
"upc": null,
|
||||
"updated_at": Any<Date>,
|
||||
"variant_rank": 0,
|
||||
"weight": null,
|
||||
"width": null,
|
||||
},
|
||||
@@ -1384,6 +1391,7 @@ Object {
|
||||
"title": "Practical Granite Pizza",
|
||||
"upc": null,
|
||||
"updated_at": Any<Date>,
|
||||
"variant_rank": 0,
|
||||
"weight": null,
|
||||
"width": null,
|
||||
},
|
||||
@@ -1598,6 +1606,7 @@ Object {
|
||||
"title": "Practical Granite Pizza",
|
||||
"upc": null,
|
||||
"updated_at": Any<Date>,
|
||||
"variant_rank": 0,
|
||||
"weight": null,
|
||||
"width": null,
|
||||
},
|
||||
@@ -1716,6 +1725,7 @@ Object {
|
||||
"title": "Practical Granite Pizza",
|
||||
"upc": null,
|
||||
"updated_at": Any<Date>,
|
||||
"variant_rank": 0,
|
||||
"weight": null,
|
||||
"width": null,
|
||||
},
|
||||
@@ -1900,6 +1910,7 @@ Object {
|
||||
"title": "Practical Granite Pizza",
|
||||
"upc": null,
|
||||
"updated_at": Any<Date>,
|
||||
"variant_rank": 0,
|
||||
"weight": null,
|
||||
"width": null,
|
||||
},
|
||||
@@ -2061,6 +2072,7 @@ Object {
|
||||
"title": "Small Wooden Computer",
|
||||
"upc": null,
|
||||
"updated_at": Any<Date>,
|
||||
"variant_rank": 0,
|
||||
"weight": null,
|
||||
"width": null,
|
||||
},
|
||||
@@ -2169,6 +2181,7 @@ Object {
|
||||
"title": "Practical Granite Pizza",
|
||||
"upc": null,
|
||||
"updated_at": Any<Date>,
|
||||
"variant_rank": 0,
|
||||
"weight": null,
|
||||
"width": null,
|
||||
},
|
||||
@@ -2291,6 +2304,7 @@ Object {
|
||||
"title": "Small Wooden Computer",
|
||||
"upc": null,
|
||||
"updated_at": Any<Date>,
|
||||
"variant_rank": 0,
|
||||
"weight": null,
|
||||
"width": null,
|
||||
},
|
||||
@@ -2407,6 +2421,7 @@ Object {
|
||||
"title": "Small Wooden Computer",
|
||||
"upc": null,
|
||||
"updated_at": Any<Date>,
|
||||
"variant_rank": 0,
|
||||
"weight": null,
|
||||
"width": null,
|
||||
},
|
||||
@@ -2414,7 +2429,6 @@ Object {
|
||||
},
|
||||
],
|
||||
"allow_backorder": true,
|
||||
"beforeInsert": [Function],
|
||||
"canceled_at": null,
|
||||
"cart_id": Any<String>,
|
||||
"confirmed_at": Any<Date>,
|
||||
|
||||
@@ -6,7 +6,7 @@ const { setPort, useApi } = require("../../../helpers/use-api")
|
||||
|
||||
const adminSeeder = require("../../helpers/admin-seeder")
|
||||
|
||||
jest.setTimeout(30000)
|
||||
jest.setTimeout(50000)
|
||||
|
||||
const {
|
||||
simpleOrderFactory,
|
||||
@@ -343,8 +343,6 @@ describe("medusa-plugin-sendgrid", () => {
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
|
||||
const swap = response.data.order.swaps[0]
|
||||
const returnOrder = swap.return_order
|
||||
await api.post(
|
||||
@@ -421,7 +419,6 @@ describe("medusa-plugin-sendgrid", () => {
|
||||
price: 500,
|
||||
})
|
||||
const api = useApi()
|
||||
|
||||
const response = await api.post(
|
||||
`/admin/orders/${order.id}/claims`,
|
||||
{
|
||||
@@ -557,11 +554,14 @@ describe("medusa-plugin-sendgrid", () => {
|
||||
phone: "12353245",
|
||||
},
|
||||
})
|
||||
|
||||
await api.post(`/store/carts/${cartId}/shipping-methods`, {
|
||||
option_id: shippingOut.id,
|
||||
})
|
||||
|
||||
await api.post(`/store/carts/${cartId}/payment-sessions`)
|
||||
await api.post(`/store/carts/${cartId}/complete`)
|
||||
|
||||
const { data: fulfillmentData } = await api.post(
|
||||
`/admin/orders/${order.id}/swaps/${swapId}/fulfillments`,
|
||||
{},
|
||||
@@ -741,7 +741,6 @@ describe("medusa-plugin-sendgrid", () => {
|
||||
|
||||
const order = await createReturnableOrder(dbConnection)
|
||||
const api = useApi()
|
||||
|
||||
const response = await api.post(
|
||||
`/admin/orders/${order.id}/swaps`,
|
||||
{
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
import { Connection } from "typeorm"
|
||||
import faker from "faker"
|
||||
import {
|
||||
ShippingProfileType,
|
||||
ShippingProfile,
|
||||
Product,
|
||||
ProductType,
|
||||
ProductOption,
|
||||
} from "@medusajs/medusa"
|
||||
import { Product, ProductOption, ProductType, ShippingProfile, ShippingProfileType, } from "@medusajs/medusa"
|
||||
|
||||
import {
|
||||
simpleProductVariantFactory,
|
||||
ProductVariantFactoryData,
|
||||
} from "./simple-product-variant-factory"
|
||||
import { ProductVariantFactoryData, simpleProductVariantFactory, } from "./simple-product-variant-factory"
|
||||
|
||||
export type ProductFactoryData = {
|
||||
id?: string
|
||||
@@ -34,11 +25,11 @@ export const simpleProductFactory = async (
|
||||
const manager = connection.manager
|
||||
|
||||
const defaultProfile = await manager.findOne(ShippingProfile, {
|
||||
type: ShippingProfileType.DEFAULT,
|
||||
where: { type: ShippingProfileType.DEFAULT },
|
||||
})
|
||||
|
||||
const gcProfile = await manager.findOne(ShippingProfile, {
|
||||
type: ShippingProfileType.GIFT_CARD,
|
||||
where: { type: ShippingProfileType.GIFT_CARD },
|
||||
})
|
||||
|
||||
let typeId: string
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import { Connection } from "typeorm"
|
||||
import faker from "faker"
|
||||
import {
|
||||
ShippingOptionPriceType,
|
||||
ShippingProfile,
|
||||
ShippingOption,
|
||||
ShippingProfileType,
|
||||
} from "@medusajs/medusa"
|
||||
import { ShippingOption, ShippingOptionPriceType, ShippingProfile, ShippingProfileType, } from "@medusajs/medusa"
|
||||
|
||||
export type ShippingOptionFactoryData = {
|
||||
name?: string
|
||||
@@ -26,11 +21,11 @@ export const simpleShippingOptionFactory = async (
|
||||
|
||||
const manager = connection.manager
|
||||
const defaultProfile = await manager.findOne(ShippingProfile, {
|
||||
type: ShippingProfileType.DEFAULT,
|
||||
where: { type: ShippingProfileType.DEFAULT },
|
||||
})
|
||||
|
||||
const gcProfile = await manager.findOne(ShippingProfile, {
|
||||
type: ShippingProfileType.GIFT_CARD,
|
||||
where: { type: ShippingProfileType.GIFT_CARD },
|
||||
})
|
||||
|
||||
const created = manager.create(ShippingOption, {
|
||||
|
||||
@@ -1,22 +1,27 @@
|
||||
import { SalesChannel, Store } from "@medusajs/medusa"
|
||||
import faker from "faker"
|
||||
import { Connection } from "typeorm"
|
||||
import { DataSource, Not, IsNull } from "typeorm"
|
||||
|
||||
export type StoreFactoryData = {
|
||||
swap_link_template?: string
|
||||
}
|
||||
|
||||
export const simpleStoreFactory = async (
|
||||
connection: Connection,
|
||||
dataSource: DataSource,
|
||||
data: StoreFactoryData = {},
|
||||
seed?: number
|
||||
): Promise<Store> => {
|
||||
): Promise<Store | undefined> => {
|
||||
if (typeof seed !== "undefined") {
|
||||
faker.seed(seed)
|
||||
}
|
||||
|
||||
const manager = connection.manager
|
||||
const store = await manager.findOne(Store)
|
||||
const manager = dataSource.manager
|
||||
const stores = await manager.find(Store, { where: { id: Not(IsNull()) } })
|
||||
const store = stores[0]
|
||||
|
||||
if (!store) {
|
||||
return
|
||||
}
|
||||
|
||||
store.swap_link_template = data.swap_link_template ?? "something/{cart_id}"
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ const {
|
||||
LineItem,
|
||||
Payment,
|
||||
PaymentSession,
|
||||
ShippingProfileType,
|
||||
} = require("@medusajs/medusa")
|
||||
|
||||
module.exports = async (connection, data = {}) => {
|
||||
@@ -34,11 +35,15 @@ module.exports = async (connection, data = {}) => {
|
||||
const manager = connection.manager
|
||||
|
||||
const defaultProfile = await manager.findOne(ShippingProfile, {
|
||||
type: "default",
|
||||
where: {
|
||||
type: ShippingProfileType.DEFAULT,
|
||||
},
|
||||
})
|
||||
|
||||
const gcProfile = await manager.findOne(ShippingProfile, {
|
||||
type: "gift_card",
|
||||
where: {
|
||||
type: ShippingProfileType.GIFT_CARD,
|
||||
},
|
||||
})
|
||||
|
||||
await manager.insert(Address, {
|
||||
|
||||
@@ -14,13 +14,16 @@ const {
|
||||
Discount,
|
||||
DiscountRule,
|
||||
Payment,
|
||||
ShippingProfileType,
|
||||
} = require("@medusajs/medusa")
|
||||
|
||||
module.exports = async (connection, data = {}) => {
|
||||
const manager = connection.manager
|
||||
|
||||
const defaultProfile = await manager.findOne(ShippingProfile, {
|
||||
type: "default",
|
||||
where: {
|
||||
type: ShippingProfileType.DEFAULT,
|
||||
},
|
||||
})
|
||||
|
||||
await manager.insert(Product, {
|
||||
|
||||
@@ -13,13 +13,16 @@ const {
|
||||
ShippingOption,
|
||||
ShippingProfile,
|
||||
Swap,
|
||||
ShippingProfileType,
|
||||
} = require("@medusajs/medusa")
|
||||
|
||||
module.exports = async (connection, data = {}) => {
|
||||
const manager = connection.manager
|
||||
|
||||
const defaultProfile = await manager.findOne(ShippingProfile, {
|
||||
type: "default",
|
||||
where: {
|
||||
type: ShippingProfileType.DEFAULT,
|
||||
},
|
||||
})
|
||||
|
||||
await manager.insert(Product, {
|
||||
|
||||
@@ -8,13 +8,16 @@ const {
|
||||
ShippingProfile,
|
||||
ProductVariant,
|
||||
Image,
|
||||
ShippingProfileType,
|
||||
} = require("@medusajs/medusa")
|
||||
|
||||
module.exports = async (connection, data = {}) => {
|
||||
const manager = connection.manager
|
||||
|
||||
const defaultProfile = await manager.findOne(ShippingProfile, {
|
||||
type: "default",
|
||||
where: {
|
||||
type: ShippingProfileType.DEFAULT,
|
||||
},
|
||||
})
|
||||
|
||||
const coll = manager.create(ProductCollection, {
|
||||
|
||||
@@ -3,6 +3,7 @@ const {
|
||||
ShippingProfile,
|
||||
ShippingOption,
|
||||
ShippingOptionRequirement,
|
||||
ShippingProfileType,
|
||||
} = require("@medusajs/medusa")
|
||||
|
||||
module.exports = async (connection, data = {}) => {
|
||||
@@ -16,7 +17,9 @@ module.exports = async (connection, data = {}) => {
|
||||
})
|
||||
|
||||
const defaultProfile = await manager.findOne(ShippingProfile, {
|
||||
type: "default",
|
||||
where: {
|
||||
type: ShippingProfileType.DEFAULT,
|
||||
},
|
||||
})
|
||||
|
||||
await manager.insert(ShippingOption, {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"medusa-fulfillment-webshipper": "*",
|
||||
"medusa-interfaces": "*",
|
||||
"medusa-plugin-sendgrid": "*",
|
||||
"typeorm": "^0.2.31"
|
||||
"typeorm": "^0.3.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.12.10",
|
||||
|
||||
Reference in New Issue
Block a user