fix: more adjustments

add: composite unique constraint for shipping_option_id and cart_id
fix: fetchCartOptions to format custom shipping options like normal shipping options
fix: addShippingMethod should throw when custom shipping options is not empty and no optionId corresponds to custom shipping options
This commit is contained in:
zakariaelas
2021-10-07 14:54:05 +01:00
parent 52be911e50
commit 3d088c351b
8 changed files with 87 additions and 97 deletions
@@ -160,7 +160,7 @@ describe("/store/shipping-options", () => {
)
})
it("given a swap cart, when user retrieves its shipping options, then should return a list of custom shipping options", async () => {
it("given a cart with custom shipping options, when user retrieves its shipping options, then should return the list of custom shipping options", async () => {
const api = useApi()
const response = await api
@@ -173,8 +173,9 @@ describe("/store/shipping-options", () => {
expect(response.data.shipping_options).toEqual(
expect.arrayContaining([
expect.objectContaining({
shipping_option_id: "test-option",
price: 0,
id: "test-option",
amount: 0,
name: "test-option",
}),
])
)