removed changes wrongfully included
This commit is contained in:
1 parent
7cecc021f4
commit
927a270c6b
4 files changed
+2
-67
No files matched your search
@@ -5,10 +5,8 @@ const { Region } = require("@medusajs/medusa");
|
|||||||
const setupServer = require("../../../helpers/setup-server");
|
const setupServer = require("../../../helpers/setup-server");
|
||||||
const { useApi } = require("../../../helpers/use-api");
|
const { useApi } = require("../../../helpers/use-api");
|
||||||
const { initDb } = require("../../../helpers/use-db");
|
const { initDb } = require("../../../helpers/use-db");
|
||||||
const { expectRelations } = require("../../helpers/expect-relations");
|
|
||||||
|
|
||||||
const cartSeeder = require("../../helpers/cart-seeder");
|
const cartSeeder = require("../../helpers/cart-seeder");
|
||||||
const productSeeder = require("../../helpers/product-seeder");
|
|
||||||
|
|
||||||
jest.setTimeout(30000);
|
jest.setTimeout(30000);
|
||||||
|
|
||||||
@@ -332,56 +330,4 @@ describe("/store/carts", () => {
|
|||||||
expect(response.status).toEqual(200);
|
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)
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
@@ -6,7 +6,6 @@ const {
|
|||||||
Product,
|
Product,
|
||||||
ShippingProfile,
|
ShippingProfile,
|
||||||
ProductVariant,
|
ProductVariant,
|
||||||
MoneyAmount,
|
|
||||||
Image,
|
Image,
|
||||||
} = require("@medusajs/medusa");
|
} = require("@medusajs/medusa");
|
||||||
|
|
||||||
@@ -81,14 +80,7 @@ module.exports = async (connection, data = {}) => {
|
|||||||
upc: "test-upc",
|
upc: "test-upc",
|
||||||
barcode: "test-barcode",
|
barcode: "test-barcode",
|
||||||
product_id: "test-product",
|
product_id: "test-product",
|
||||||
prices: [],
|
prices: [{ id: "test-price", currency_code: "usd", amount: 100 }],
|
||||||
options: [{ id: "test-variant-option", value: "Default variant" }],
|
options: [{ id: "test-variant-option", value: "Default variant" }],
|
||||||
});
|
});
|
||||||
|
|
||||||
await manager.insert(MoneyAmount, {
|
|
||||||
variant_id: "test-variant",
|
|
||||||
id: "test-price",
|
|
||||||
currency_code: "usd",
|
|
||||||
amount: 100,
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
@@ -36,10 +36,8 @@ module.exports = {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const databaseName = "medusa-integration";
|
const databaseName = "medusa-integration";
|
||||||
|
|
||||||
await createDatabase({ databaseName });
|
await createDatabase({ databaseName });
|
||||||
|
|
||||||
|
|
||||||
const connection = await createConnection({
|
const connection = await createConnection({
|
||||||
type: "postgres",
|
type: "postgres",
|
||||||
url: "postgres://localhost/medusa-integration",
|
url: "postgres://localhost/medusa-integration",
|
||||||
@@ -68,7 +66,6 @@ module.exports = {
|
|||||||
|
|
||||||
instance.setDb(dbConnection);
|
instance.setDb(dbConnection);
|
||||||
return dbConnection;
|
return dbConnection;
|
||||||
|
|
||||||
},
|
},
|
||||||
useDb: function () {
|
useDb: function () {
|
||||||
return instance;
|
return instance;
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ export class LineItem {
|
|||||||
@Column({ nullable: true })
|
@Column({ nullable: true })
|
||||||
variant_id: string
|
variant_id: string
|
||||||
|
|
||||||
@ManyToOne(() => ProductVariant)
|
@ManyToOne(() => ProductVariant, { eager: true })
|
||||||
@JoinColumn({ name: "variant_id" })
|
@JoinColumn({ name: "variant_id" })
|
||||||
variant: ProductVariant
|
variant: ProductVariant
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user