feat(medusa): Improve config loading (#1290)
This commit is contained in:
@@ -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"] })
|
||||
}
|
||||
|
||||
@@ -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'
|
||||
},
|
||||
}
|
||||
|
||||
@@ -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'
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user