removed changes wrongfully included

This commit is contained in:
--list
2021-07-02 12:38:46 +02:00
parent 7cecc021f4
commit 927a270c6b
4 changed files with 3 additions and 68 deletions

View File

@@ -5,10 +5,8 @@ const { Region } = require("@medusajs/medusa");
const setupServer = require("../../../helpers/setup-server");
const { useApi } = require("../../../helpers/use-api");
const { initDb } = require("../../../helpers/use-db");
const { expectRelations } = require("../../helpers/expect-relations");
const cartSeeder = require("../../helpers/cart-seeder");
const productSeeder = require("../../helpers/product-seeder");
jest.setTimeout(30000);
@@ -332,56 +330,4 @@ describe("/store/carts", () => {
expect(response.status).toEqual(200);
});
});
describe("get-cart returns expected relations", () => {
beforeEach(async () => {
try {
await productSeeder(dbConnection);
await cartSeeder(dbConnection);
} catch (err) {
console.log(err);
throw err;
}
});
afterEach(async () => {
const manager = dbConnection.manager;
await doAfterEach(manager);
});
it("returns default relations", async () => {
const api = useApi();
const expectedRelations = [
"gift_cards",
"region",
"items.variant.prices",
"payment",
"shipping_address",
"billing_address",
"region.countries",
"region.payment_providers",
"payment_sessions",
"shipping_methods.shipping_option",
"discounts",
]
await api.post("/store/carts/test-cart/line-items", {
quantity: 1,
variant_id: "test-variant",
})
// await api.post("/store/carts/test-cart/shipping-methods", {
// option_id: "test-option"
// })
const response = await api.get("/store/carts/test-cart")
console.log(response.data.cart)
expectRelations(expectedRelations, response.data.cart)
});
});
});

View File

@@ -6,7 +6,6 @@ const {
Product,
ShippingProfile,
ProductVariant,
MoneyAmount,
Image,
} = require("@medusajs/medusa");
@@ -81,14 +80,7 @@ module.exports = async (connection, data = {}) => {
upc: "test-upc",
barcode: "test-barcode",
product_id: "test-product",
prices: [],
prices: [{ id: "test-price", currency_code: "usd", amount: 100 }],
options: [{ id: "test-variant-option", value: "Default variant" }],
});
await manager.insert(MoneyAmount, {
variant_id: "test-variant",
id: "test-price",
currency_code: "usd",
amount: 100,
});
};

View File

@@ -36,10 +36,8 @@ module.exports = {
);
const databaseName = "medusa-integration";
await createDatabase({ databaseName });
const connection = await createConnection({
type: "postgres",
url: "postgres://localhost/medusa-integration",
@@ -68,7 +66,6 @@ module.exports = {
instance.setDb(dbConnection);
return dbConnection;
},
useDb: function () {
return instance;

View File

@@ -99,7 +99,7 @@ export class LineItem {
@Column({ nullable: true })
variant_id: string
@ManyToOne(() => ProductVariant)
@ManyToOne(() => ProductVariant, { eager: true })
@JoinColumn({ name: "variant_id" })
variant: ProductVariant