hotfix: Allow sale_amount product updates (#346)
This commit is contained in:
@@ -173,12 +173,18 @@ describe("/admin/products", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("updates a product (update tags, delete collection, delete type, replaces images)", async () => {
|
it("updates a product (update prices, tags, delete collection, delete type, replaces images)", async () => {
|
||||||
const api = useApi();
|
const api = useApi();
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
collection_id: null,
|
collection_id: null,
|
||||||
type: null,
|
type: null,
|
||||||
|
variants: [
|
||||||
|
{
|
||||||
|
id: "test-variant",
|
||||||
|
prices: [{ currency_code: "usd", amount: 100, sale_amount: 75 }],
|
||||||
|
},
|
||||||
|
],
|
||||||
tags: [{ value: "123" }],
|
tags: [{ value: "123" }],
|
||||||
images: ["test-image-2.png"],
|
images: ["test-image-2.png"],
|
||||||
type: { value: "test-type-2" },
|
type: { value: "test-type-2" },
|
||||||
@@ -209,6 +215,16 @@ describe("/admin/products", () => {
|
|||||||
value: "123",
|
value: "123",
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
variants: [
|
||||||
|
expect.objectContaining({
|
||||||
|
prices: [
|
||||||
|
expect.objectContaining({
|
||||||
|
sale_amount: 75,
|
||||||
|
amount: 100,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
type: null,
|
type: null,
|
||||||
collection: null,
|
collection: null,
|
||||||
type: expect.objectContaining({
|
type: expect.objectContaining({
|
||||||
|
|||||||
@@ -246,6 +246,7 @@ export default async (req, res) => {
|
|||||||
amount: Validator.number()
|
amount: Validator.number()
|
||||||
.integer()
|
.integer()
|
||||||
.required(),
|
.required(),
|
||||||
|
sale_amount: Validator.number().optional(),
|
||||||
})
|
})
|
||||||
.xor("region_id", "currency_code")
|
.xor("region_id", "currency_code")
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user