chore: move to swc/jest (#7739)

* chore: move to swc

* chore: fix tax rate tests

* chore: undo failed test

* chore: fix unit tests script

* chore: use node 20

* Update scripts/run-workspace-unit-tests-in-chunks.sh
This commit is contained in:
Riqwan Thamir
2024-06-20 12:59:33 +02:00
committed by GitHub
parent f61557712c
commit 03924a4ff6
137 changed files with 386 additions and 419 deletions
+5 -4
View File
@@ -16,6 +16,7 @@ import {
OptionalProps,
PrimaryKey,
Property,
Rel,
} from "@mikro-orm/core"
import Address from "./address"
import LineItem from "./line-item"
@@ -115,7 +116,7 @@ export default class Cart {
cascade: [Cascade.PERSIST],
nullable: true,
})
shipping_address: Address | null
shipping_address: Rel<Address> | null
@BillingAddressIdIndex()
@ManyToOne({
@@ -131,7 +132,7 @@ export default class Cart {
cascade: [Cascade.PERSIST],
nullable: true,
})
billing_address: Address | null
billing_address: Rel<Address> | null
@Property({ columnType: "jsonb", nullable: true })
metadata: Record<string, unknown> | null = null
@@ -139,12 +140,12 @@ export default class Cart {
@OneToMany(() => LineItem, (lineItem) => lineItem.cart, {
cascade: [Cascade.PERSIST, "soft-remove"] as any,
})
items = new Collection<LineItem>(this)
items = new Collection<Rel<LineItem>>(this)
@OneToMany(() => ShippingMethod, (shippingMethod) => shippingMethod.cart, {
cascade: [Cascade.PERSIST, "soft-remove"] as any,
})
shipping_methods = new Collection<ShippingMethod>(this)
shipping_methods = new Collection<Rel<ShippingMethod>>(this)
@Property({
onCreate: () => new Date(),
@@ -11,6 +11,7 @@ import {
ManyToOne,
OnInit,
Property,
Rel,
} from "@mikro-orm/core"
import AdjustmentLine from "./adjustment-line"
import LineItem from "./line-item"
@@ -42,7 +43,7 @@ const DeletedAtIndex = createPsqlIndexStatementHelper({
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
export default class LineItemAdjustment extends AdjustmentLine {
@ManyToOne({ entity: () => LineItem, persist: false })
item: LineItem
item: Rel<LineItem>
@LineItemIdIndex()
@ManyToOne({
@@ -10,6 +10,7 @@ import {
ManyToOne,
OnInit,
Property,
Rel,
} from "@mikro-orm/core"
import LineItem from "./line-item"
import TaxLine from "./tax-line"
@@ -38,7 +39,7 @@ const DeletedAtIndex = createPsqlIndexStatementHelper({
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
export default class LineItemTaxLine extends TaxLine {
@ManyToOne({ entity: () => LineItem, persist: false })
item: LineItem
item: Rel<LineItem>
@LineItemIdIndex()
@ManyToOne({
@@ -18,6 +18,7 @@ import {
OptionalProps,
PrimaryKey,
Property,
Rel,
} from "@mikro-orm/core"
import Cart from "./cart"
import LineItemAdjustment from "./line-item-adjustment"
@@ -76,7 +77,7 @@ export default class LineItem {
cart_id: string
@ManyToOne({ entity: () => Cart, persist: false })
cart: Cart
cart: Rel<Cart>
@Property({ columnType: "text" })
title: string
@@ -129,13 +130,13 @@ export default class LineItem {
variant_option_values: Record<string, unknown> | null = null
@Property({ columnType: "boolean" })
requires_shipping = true
requires_shipping: boolean = true
@Property({ columnType: "boolean" })
is_discountable = true
is_discountable: boolean = true
@Property({ columnType: "boolean" })
is_tax_inclusive = false
is_tax_inclusive: boolean = false
@MikroOrmBigNumberProperty({ nullable: true })
compare_at_unit_price?: BigNumber | number | null = null
@@ -152,12 +153,12 @@ export default class LineItem {
@OneToMany(() => LineItemTaxLine, (taxLine) => taxLine.item, {
cascade: [Cascade.PERSIST, "soft-remove"] as any,
})
tax_lines = new Collection<LineItemTaxLine>(this)
tax_lines = new Collection<Rel<LineItemTaxLine>>(this)
@OneToMany(() => LineItemAdjustment, (adjustment) => adjustment.item, {
cascade: [Cascade.PERSIST, "soft-remove"] as any,
})
adjustments = new Collection<LineItemAdjustment>(this)
adjustments = new Collection<Rel<LineItemAdjustment>>(this)
@Property({ columnType: "jsonb", nullable: true })
metadata: Record<string, unknown> | null = null
@@ -10,6 +10,7 @@ import {
ManyToOne,
OnInit,
Property,
Rel,
} from "@mikro-orm/core"
import AdjustmentLine from "./adjustment-line"
import ShippingMethod from "./shipping-method"
@@ -38,7 +39,7 @@ const DeletedAtIndex = createPsqlIndexStatementHelper({
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
export default class ShippingMethodAdjustment extends AdjustmentLine {
@ManyToOne({ entity: () => ShippingMethod, persist: false })
shipping_method: ShippingMethod
shipping_method: Rel<ShippingMethod>
@ShippingMethodIdIndex()
@ManyToOne({
@@ -10,6 +10,7 @@ import {
ManyToOne,
OnInit,
Property,
Rel,
} from "@mikro-orm/core"
import ShippingMethod from "./shipping-method"
import TaxLine from "./tax-line"
@@ -38,7 +39,7 @@ const DeletedAtIndex = createPsqlIndexStatementHelper({
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
export default class ShippingMethodTaxLine extends TaxLine {
@ManyToOne({ entity: () => ShippingMethod, persist: false })
shipping_method: ShippingMethod
shipping_method: Rel<ShippingMethod>
@ShippingMethodIdIndex()
@ManyToOne({
@@ -19,6 +19,7 @@ import {
OptionalProps,
PrimaryKey,
Property,
Rel,
} from "@mikro-orm/core"
import Cart from "./cart"
import ShippingMethodAdjustment from "./shipping-method-adjustment"
@@ -68,7 +69,7 @@ export default class ShippingMethod {
cart_id: string
@ManyToOne({ entity: () => Cart, persist: false })
cart: Cart
cart: Rel<Cart>
@Property({ columnType: "text" })
name: string
@@ -83,7 +84,7 @@ export default class ShippingMethod {
raw_amount: BigNumberRawValue
@Property({ columnType: "boolean" })
is_tax_inclusive = false
is_tax_inclusive: boolean = false
@ShippingOptionIdIndex()
@Property({ columnType: "text", nullable: true })
@@ -102,7 +103,7 @@ export default class ShippingMethod {
cascade: [Cascade.PERSIST, "soft-remove"] as any,
}
)
tax_lines = new Collection<ShippingMethodTaxLine>(this)
tax_lines = new Collection<Rel<ShippingMethodTaxLine>>(this)
@OneToMany(
() => ShippingMethodAdjustment,
@@ -111,7 +112,7 @@ export default class ShippingMethod {
cascade: [Cascade.PERSIST, "soft-remove"] as any,
}
)
adjustments = new Collection<ShippingMethodAdjustment>(this)
adjustments = new Collection<Rel<ShippingMethodAdjustment>>(this)
@Property({
onCreate: () => new Date(),