added missing brackets to control structures

This commit is contained in:
pKorsholm
2021-09-09 09:26:49 +02:00
parent 1331a7d4ce
commit 84e2081955
3 changed files with 9 additions and 5 deletions

View File

@@ -36,9 +36,9 @@ export const ProductServiceMock = {
if (data.title === "Test Product") {
return Promise.resolve(products.product1)
}
if (data.title === "Test Product with variants")
if (data.title === "Test Product with variants") {
return Promise.resolve(products.productWithOptions)
}
return Promise.resolve({ ...data })
}),
count: jest.fn().mockReturnValue(4),

View File

@@ -12,7 +12,7 @@ describe("ProductService", () => {
describe("retrieve", () => {
const productRepo = MockRepository({
findOneWithRelations: (rels, query) => {
if (query.where.id === "test id with variants")
if (query.where.id === "test id with variants") {
return {
id: "test id with variants",
variants: [
@@ -20,11 +20,13 @@ describe("ProductService", () => {
{ id: "test_123", title: "Blue" },
],
}
if (query.where.id === "test id one variant")
}
if (query.where.id === "test id one variant") {
return {
id: "test id one variant",
variants: [{ id: "test_123", title: "Blue" }],
}
}
return Promise.resolve({ id: IdMap.getId("ironman") })
},
})

View File

@@ -174,7 +174,9 @@ class ProductVariantService extends BaseService {
)
}
if (!rest.variant_rank) rest.variant_rank = product.variants.length
if (!rest.variant_rank) {
rest.variant_rank = product.variants.length
}
const toCreate = {
...rest,