added missing brackets to control structures
This commit is contained in:
@@ -36,9 +36,9 @@ export const ProductServiceMock = {
|
|||||||
if (data.title === "Test Product") {
|
if (data.title === "Test Product") {
|
||||||
return Promise.resolve(products.product1)
|
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(products.productWithOptions)
|
||||||
|
}
|
||||||
return Promise.resolve({ ...data })
|
return Promise.resolve({ ...data })
|
||||||
}),
|
}),
|
||||||
count: jest.fn().mockReturnValue(4),
|
count: jest.fn().mockReturnValue(4),
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ describe("ProductService", () => {
|
|||||||
describe("retrieve", () => {
|
describe("retrieve", () => {
|
||||||
const productRepo = MockRepository({
|
const productRepo = MockRepository({
|
||||||
findOneWithRelations: (rels, query) => {
|
findOneWithRelations: (rels, query) => {
|
||||||
if (query.where.id === "test id with variants")
|
if (query.where.id === "test id with variants") {
|
||||||
return {
|
return {
|
||||||
id: "test id with variants",
|
id: "test id with variants",
|
||||||
variants: [
|
variants: [
|
||||||
@@ -20,11 +20,13 @@ describe("ProductService", () => {
|
|||||||
{ id: "test_123", title: "Blue" },
|
{ id: "test_123", title: "Blue" },
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
if (query.where.id === "test id one variant")
|
}
|
||||||
|
if (query.where.id === "test id one variant") {
|
||||||
return {
|
return {
|
||||||
id: "test id one variant",
|
id: "test id one variant",
|
||||||
variants: [{ id: "test_123", title: "Blue" }],
|
variants: [{ id: "test_123", title: "Blue" }],
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return Promise.resolve({ id: IdMap.getId("ironman") })
|
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 = {
|
const toCreate = {
|
||||||
...rest,
|
...rest,
|
||||||
|
|||||||
Reference in New Issue
Block a user