hotfix: Allow sale_amount product updates (#346)

This commit is contained in:
Oliver Windall Juhl
2021-08-20 17:14:19 +02:00
committed by GitHub
parent fd14e243da
commit 5d63b0c8d2
2 changed files with 18 additions and 1 deletions

View File

@@ -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 payload = {
collection_id: null,
type: null,
variants: [
{
id: "test-variant",
prices: [{ currency_code: "usd", amount: 100, sale_amount: 75 }],
},
],
tags: [{ value: "123" }],
images: ["test-image-2.png"],
type: { value: "test-type-2" },
@@ -209,6 +215,16 @@ describe("/admin/products", () => {
value: "123",
}),
],
variants: [
expect.objectContaining({
prices: [
expect.objectContaining({
sale_amount: 75,
amount: 100,
}),
],
}),
],
type: null,
collection: null,
type: expect.objectContaining({

View File

@@ -246,6 +246,7 @@ export default async (req, res) => {
amount: Validator.number()
.integer()
.required(),
sale_amount: Validator.number().optional(),
})
.xor("region_id", "currency_code")
),