chore:ttests

This commit is contained in:
Sebastian Rindom
2021-06-08 13:31:05 +02:00
parent 91511cbdf8
commit 0f1f51311e
2 changed files with 11 additions and 2 deletions

View File

@@ -10,10 +10,10 @@ describe("POST /store/carts/:id/payment-session/update", () => {
const cartId = IdMap.getId("cartWithPaySessions")
subject = await request(
"POST",
`/store/carts/${cartId}/payment-session/update`,
`/store/carts/${cartId}/payment-sessions/default_provider`,
{
payload: {
session: {
data: {
data: "Something",
},
},
@@ -26,6 +26,12 @@ describe("POST /store/carts/:id/payment-session/update", () => {
})
it("calls CartService updatePaymentSession", () => {
expect(CartServiceMock.setPaymentSession).toHaveBeenCalledTimes(1)
expect(CartServiceMock.setPaymentSession).toHaveBeenCalledWith(
IdMap.getId("cartWithPaySessions"),
"default_provider"
)
expect(CartServiceMock.updatePaymentSession).toHaveBeenCalledTimes(1)
expect(CartServiceMock.updatePaymentSession).toHaveBeenCalledWith(
IdMap.getId("cartWithPaySessions"),

View File

@@ -323,6 +323,9 @@ export const CartServiceMock = {
applyDiscount: jest.fn().mockImplementation((cartId, code) => {
return Promise.resolve()
}),
setPaymentSession: jest.fn().mockImplementation(cartId => {
return Promise.resolve()
}),
setPaymentSessions: jest.fn().mockImplementation(cartId => {
return Promise.resolve()
}),