feat(medusa): Improve config loading (#1290)

This commit is contained in:
Adrien de Peretti
2022-04-21 12:49:56 +02:00
committed by GitHub
parent 89a6de4660
commit 313cb0658b
25 changed files with 225 additions and 175 deletions
@@ -28,7 +28,7 @@ export const simpleProductFactory = async (
connection: Connection,
data: ProductFactoryData = {},
seed?: number
): Promise<Product> => {
): Promise<Product | undefined> => {
if (typeof seed !== "undefined") {
faker.seed(seed)
}
@@ -50,9 +50,9 @@ export const simpleProductFactory = async (
status: data.status,
is_giftcard: data.is_giftcard || false,
discountable: !data.is_giftcard,
tags: [],
profile_id: data.is_giftcard ? gcProfile.id : defaultProfile.id,
}
tags: [] as ProductTag[],
profile_id: data.is_giftcard ? gcProfile?.id : defaultProfile?.id,
} as Product
if (typeof data.tags !== "undefined") {
for (let i = 0; i < data.tags.length; i++) {
@@ -112,5 +112,5 @@ export const simpleProductFactory = async (
await simpleProductVariantFactory(connection, factoryData)
}
return await manager.findOne(Product, { id: prodId }, { relations: ["tags"] })
return manager.findOne(Product, { id: prodId }, { relations: ["tags"] })
}
+2
View File
@@ -8,5 +8,7 @@ module.exports = {
// redis_url: REDIS_URL,
database_url: `postgres://${DB_USERNAME}:${DB_PASSWORD}@localhost/medusa-integration-${workerId}`,
database_type: "postgres",
jwt_secret: 'test',
cookie_secret: 'test'
},
}
+1
View File
@@ -6,6 +6,7 @@ const pkgs = glob
module.exports = {
testEnvironment: `node`,
testTimeout: 10000,
globalSetup: "<rootDir>/integration-tests/globalSetup.js",
globalTeardown: "<rootDir>/integration-tests/globalTeardown.js",
rootDir: `../`,
@@ -24,5 +24,7 @@ module.exports = {
// redis_url: REDIS_URL,
database_url: `postgres://${DB_USERNAME}:${DB_PASSWORD}@localhost/medusa-integration-${workerId}`,
database_type: "postgres",
jwt_secret: 'test',
cookie_secret: 'test'
},
}