chore: Move factories and helpers to a better place (#4551)

* chore: Move factories and helpers to a better place

* align factory product variant

* fix factory cart

* add simple store fac

* fix tests

* fix tests

* fix

* fix cart seeder
This commit is contained in:
Adrien de Peretti
2023-07-20 13:16:04 +02:00
committed by GitHub
parent 26e2f81c24
commit 4d326fbbdf
197 changed files with 1073 additions and 4332 deletions
@@ -47,7 +47,7 @@ Object {
"should_merge": true,
"swap_id": null,
"thumbnail": "",
"title": "Intelligent Plastic Chips",
"title": "Incredible Plastic Mouse",
"unit_price": 1000,
"updated_at": Any<Date>,
"variant": Object {
@@ -87,7 +87,7 @@ Object {
"status": "draft",
"subtitle": null,
"thumbnail": null,
"title": "Awesome Metal Ball",
"title": "Gorgeous Cotton Table",
"type_id": null,
"updated_at": Any<Date>,
"weight": null,
@@ -95,7 +95,7 @@ Object {
},
"product_id": "test-product",
"sku": null,
"title": "Practical Granite Pizza",
"title": "Refined Wooden Chair",
"upc": null,
"updated_at": Any<Date>,
"variant_rank": 0,
@@ -112,7 +112,7 @@ Object {
"region_id": "test-region",
"sales_channel_id": null,
"shipping_address": Object {
"address_1": "84185 Lindsey Centers",
"address_1": "1850 Corine Tunnel",
"address_2": null,
"city": null,
"company": null,
@@ -120,12 +120,12 @@ Object {
"created_at": Any<Date>,
"customer_id": null,
"deleted_at": null,
"first_name": "Chyna",
"first_name": "Cornell",
"id": Any<String>,
"last_name": "Osinski",
"last_name": "Shanahan",
"metadata": null,
"phone": null,
"postal_code": "51510",
"postal_code": "15102-3998",
"province": null,
"updated_at": Any<Date>,
},
@@ -204,7 +204,7 @@ Object {
"should_merge": true,
"swap_id": null,
"thumbnail": "",
"title": "Intelligent Plastic Chips",
"title": "Incredible Plastic Mouse",
"unit_price": 1000,
"updated_at": Any<Date>,
"variant": Object {
@@ -244,7 +244,7 @@ Object {
"status": "draft",
"subtitle": null,
"thumbnail": null,
"title": "Awesome Metal Ball",
"title": "Gorgeous Cotton Table",
"type_id": null,
"updated_at": Any<Date>,
"weight": null,
@@ -252,7 +252,7 @@ Object {
},
"product_id": "test-product",
"sku": null,
"title": "Practical Granite Pizza",
"title": "Refined Wooden Chair",
"upc": null,
"updated_at": Any<Date>,
"variant_rank": 0,
@@ -269,7 +269,7 @@ Object {
"region_id": "test-region",
"sales_channel_id": null,
"shipping_address": Object {
"address_1": "84185 Lindsey Centers",
"address_1": "1850 Corine Tunnel",
"address_2": null,
"city": null,
"company": null,
@@ -277,12 +277,12 @@ Object {
"created_at": Any<Date>,
"customer_id": null,
"deleted_at": null,
"first_name": "Chyna",
"first_name": "Cornell",
"id": Any<String>,
"last_name": "Osinski",
"last_name": "Shanahan",
"metadata": null,
"phone": null,
"postal_code": "51510",
"postal_code": "15102-3998",
"province": null,
"updated_at": Any<Date>,
},
@@ -336,7 +336,7 @@ Object {
},
],
"thumbnail": null,
"title": "Intelligent Plastic Chips",
"title": "Incredible Plastic Mouse",
"totals": Object {
"discount_total": 0,
"original_tax_total": 200,
@@ -399,7 +399,7 @@ Object {
"status": "draft",
"subtitle": null,
"thumbnail": null,
"title": "Awesome Metal Ball",
"title": "Gorgeous Cotton Table",
"type_id": null,
"updated_at": Any<Date>,
"weight": null,
@@ -407,7 +407,7 @@ Object {
},
"product_id": "test-product",
"sku": null,
"title": "Practical Granite Pizza",
"title": "Refined Wooden Chair",
"upc": null,
"updated_at": Any<Date>,
"variant_rank": 0,
@@ -478,7 +478,7 @@ Object {
],
"tax_total": 400,
"thumbnail": "",
"title": "Intelligent Plastic Chips",
"title": "Incredible Plastic Mouse",
"total": 2400,
"unit_price": 1000,
"updated_at": Any<Date>,
@@ -519,7 +519,7 @@ Object {
"status": "draft",
"subtitle": null,
"thumbnail": null,
"title": "Awesome Metal Ball",
"title": "Gorgeous Cotton Table",
"type_id": null,
"updated_at": Any<Date>,
"weight": null,
@@ -527,7 +527,7 @@ Object {
},
"product_id": "test-product",
"sku": null,
"title": "Practical Granite Pizza",
"title": "Refined Wooden Chair",
"upc": null,
"updated_at": Any<Date>,
"variant_rank": 0,
@@ -590,7 +590,7 @@ Object {
],
"sales_channel_id": null,
"shipping_address": Object {
"address_1": "84185 Lindsey Centers",
"address_1": "1850 Corine Tunnel",
"address_2": null,
"city": null,
"company": null,
@@ -598,12 +598,12 @@ Object {
"created_at": Any<Date>,
"customer_id": null,
"deleted_at": null,
"first_name": "Chyna",
"first_name": "Cornell",
"id": Any<String>,
"last_name": "Osinski",
"last_name": "Shanahan",
"metadata": null,
"phone": null,
"postal_code": "51510",
"postal_code": "15102-3998",
"province": null,
"updated_at": Any<Date>,
},
@@ -657,7 +657,7 @@ Object {
},
],
"thumbnail": "",
"title": "Intelligent Plastic Chips",
"title": "Incredible Plastic Mouse",
"unit_price": 1000,
"updated_at": Any<Date>,
"variant": Object {
@@ -697,7 +697,7 @@ Object {
"status": "draft",
"subtitle": null,
"thumbnail": null,
"title": "Awesome Metal Ball",
"title": "Gorgeous Cotton Table",
"type_id": null,
"updated_at": Any<Date>,
"weight": null,
@@ -705,7 +705,7 @@ Object {
},
"product_id": "test-product",
"sku": null,
"title": "Practical Granite Pizza",
"title": "Refined Wooden Chair",
"upc": null,
"updated_at": Any<Date>,
"variant_rank": 0,
@@ -756,12 +756,12 @@ Object {
"created_at": Any<Date>,
"deleted_at": null,
"email": "test@testson.com",
"first_name": null,
"has_account": false,
"first_name": "Lonzo",
"has_account": true,
"id": Any<String>,
"last_name": null,
"last_name": "Kemmer",
"metadata": null,
"phone": null,
"phone": "499-811-0832",
"updated_at": Any<Date>,
},
"customer_id": Any<String>,
@@ -824,7 +824,7 @@ Object {
],
"tax_total": 400,
"thumbnail": null,
"title": "Intelligent Plastic Chips",
"title": "Handcrafted Frozen Tuna",
"total": 2400,
"unit_price": 1000,
"updated_at": Any<Date>,
@@ -983,12 +983,12 @@ Object {
"created_at": Any<Date>,
"deleted_at": null,
"email": "test@testson.com",
"first_name": null,
"has_account": false,
"first_name": "Reba",
"has_account": true,
"id": Any<String>,
"last_name": null,
"last_name": "Waelchi",
"metadata": null,
"phone": null,
"phone": "1-308-426-4696",
"updated_at": Any<Date>,
},
"customer_id": Any<String>,
@@ -1052,7 +1052,7 @@ Object {
],
"tax_total": 400,
"thumbnail": null,
"title": "Intelligent Plastic Chips",
"title": "Incredible Plastic Mouse",
"total": 2400,
"totals": Object {
"discount_total": 0,
@@ -1116,7 +1116,7 @@ Object {
"status": "draft",
"subtitle": null,
"thumbnail": null,
"title": "Awesome Metal Ball",
"title": "Gorgeous Cotton Table",
"type_id": null,
"updated_at": Any<Date>,
"weight": null,
@@ -1124,7 +1124,7 @@ Object {
},
"product_id": "test-product",
"sku": null,
"title": "Practical Granite Pizza",
"title": "Refined Wooden Chair",
"upc": null,
"updated_at": Any<Date>,
"variant_rank": 0,
@@ -1160,7 +1160,7 @@ Object {
"returns": Array [],
"sales_channel_id": null,
"shipping_address": Object {
"address_1": "84185 Lindsey Centers",
"address_1": "1850 Corine Tunnel",
"address_2": null,
"city": null,
"company": null,
@@ -1168,12 +1168,12 @@ Object {
"created_at": Any<Date>,
"customer_id": null,
"deleted_at": null,
"first_name": "Chyna",
"first_name": "Cornell",
"id": Any<String>,
"last_name": "Osinski",
"last_name": "Shanahan",
"metadata": null,
"phone": null,
"postal_code": "51510",
"postal_code": "15102-3998",
"province": null,
"updated_at": Any<Date>,
},
@@ -1235,12 +1235,12 @@ Object {
"created_at": Any<Date>,
"deleted_at": null,
"email": "test@testson.com",
"first_name": null,
"has_account": false,
"first_name": "Reba",
"has_account": true,
"id": Any<String>,
"last_name": null,
"last_name": "Waelchi",
"metadata": null,
"phone": null,
"phone": "1-308-426-4696",
"updated_at": Any<Date>,
},
"customer_id": Any<String>,
@@ -1324,7 +1324,7 @@ Object {
],
"tax_total": 400,
"thumbnail": "",
"title": "Intelligent Plastic Chips",
"title": "Incredible Plastic Mouse",
"total": 2400,
"unit_price": 1000,
"updated_at": Any<Date>,
@@ -1365,7 +1365,7 @@ Object {
"status": "draft",
"subtitle": null,
"thumbnail": null,
"title": "Awesome Metal Ball",
"title": "Gorgeous Cotton Table",
"type_id": null,
"updated_at": Any<Date>,
"weight": null,
@@ -1373,7 +1373,7 @@ Object {
},
"product_id": "test-product",
"sku": null,
"title": "Practical Granite Pizza",
"title": "Refined Wooden Chair",
"upc": null,
"updated_at": Any<Date>,
"variant_rank": 0,
@@ -1409,7 +1409,7 @@ Object {
"returns": Array [],
"sales_channel_id": null,
"shipping_address": Object {
"address_1": "84185 Lindsey Centers",
"address_1": "1850 Corine Tunnel",
"address_2": null,
"city": null,
"company": null,
@@ -1417,12 +1417,12 @@ Object {
"created_at": Any<Date>,
"customer_id": null,
"deleted_at": null,
"first_name": "Chyna",
"first_name": "Cornell",
"id": Any<String>,
"last_name": "Osinski",
"last_name": "Shanahan",
"metadata": null,
"phone": null,
"postal_code": "51510",
"postal_code": "15102-3998",
"province": null,
"updated_at": Any<Date>,
},
@@ -1511,7 +1511,7 @@ Object {
},
],
"thumbnail": null,
"title": "Intelligent Plastic Chips",
"title": "Incredible Plastic Mouse",
"totals": Object {
"discount_total": 0,
"original_tax_total": 200,
@@ -1574,7 +1574,7 @@ Object {
"status": "draft",
"subtitle": null,
"thumbnail": null,
"title": "Awesome Metal Ball",
"title": "Gorgeous Cotton Table",
"type_id": null,
"updated_at": Any<Date>,
"weight": null,
@@ -1582,7 +1582,7 @@ Object {
},
"product_id": "test-product",
"sku": null,
"title": "Practical Granite Pizza",
"title": "Refined Wooden Chair",
"upc": null,
"updated_at": Any<Date>,
"variant_rank": 0,
@@ -1653,7 +1653,7 @@ Object {
],
"tax_total": 400,
"thumbnail": "",
"title": "Intelligent Plastic Chips",
"title": "Incredible Plastic Mouse",
"total": 2400,
"unit_price": 1000,
"updated_at": Any<Date>,
@@ -1694,7 +1694,7 @@ Object {
"status": "draft",
"subtitle": null,
"thumbnail": null,
"title": "Awesome Metal Ball",
"title": "Gorgeous Cotton Table",
"type_id": null,
"updated_at": Any<Date>,
"weight": null,
@@ -1702,7 +1702,7 @@ Object {
},
"product_id": "test-product",
"sku": null,
"title": "Practical Granite Pizza",
"title": "Refined Wooden Chair",
"upc": null,
"updated_at": Any<Date>,
"variant_rank": 0,
@@ -1765,7 +1765,7 @@ Object {
],
"sales_channel_id": null,
"shipping_address": Object {
"address_1": "84185 Lindsey Centers",
"address_1": "1850 Corine Tunnel",
"address_2": null,
"city": null,
"company": null,
@@ -1773,12 +1773,12 @@ Object {
"created_at": Any<Date>,
"customer_id": null,
"deleted_at": null,
"first_name": "Chyna",
"first_name": "Cornell",
"id": Any<String>,
"last_name": "Osinski",
"last_name": "Shanahan",
"metadata": null,
"phone": null,
"postal_code": "51510",
"postal_code": "15102-3998",
"province": null,
"updated_at": Any<Date>,
},
@@ -1832,7 +1832,7 @@ Object {
},
],
"thumbnail": "",
"title": "Intelligent Plastic Chips",
"title": "Incredible Plastic Mouse",
"unit_price": 1000,
"updated_at": Any<Date>,
"variant": Object {
@@ -1872,7 +1872,7 @@ Object {
"status": "draft",
"subtitle": null,
"thumbnail": null,
"title": "Awesome Metal Ball",
"title": "Gorgeous Cotton Table",
"type_id": null,
"updated_at": Any<Date>,
"weight": null,
@@ -1880,7 +1880,7 @@ Object {
},
"product_id": "test-product",
"sku": null,
"title": "Practical Granite Pizza",
"title": "Refined Wooden Chair",
"upc": null,
"updated_at": Any<Date>,
"variant_rank": 0,
@@ -2103,7 +2103,7 @@ Object {
},
],
"thumbnail": "",
"title": "Intelligent Plastic Chips",
"title": "Handcrafted Frozen Tuna",
"unit_price": 1000,
"updated_at": Any<Date>,
"variant": Object {
@@ -1,10 +1,10 @@
const path = require("path")
const { bootstrapApp } = require("../../../helpers/bootstrap-app")
const { initDb, useDb } = require("../../../helpers/use-db")
const { setPort, useApi } = require("../../../helpers/use-api")
const { bootstrapApp } = require("../../../environment-helpers/bootstrap-app")
const { initDb, useDb } = require("../../../environment-helpers/use-db")
const { setPort, useApi } = require("../../../environment-helpers/use-api")
const adminSeeder = require("../../helpers/admin-seeder")
const adminSeeder = require("../../../helpers/admin-seeder")
jest.setTimeout(10000)
@@ -13,7 +13,7 @@ const {
simpleStoreFactory,
simpleProductFactory,
simpleShippingOptionFactory,
} = require("../../factories")
} = require("../../../factories")
describe("medusa-plugin-sendgrid", () => {
let appContainer