added missing brackets to control structures
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -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") })
|
||||
},
|
||||
})
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user