Skip to content

Commit

Permalink
feat: #56 (api) fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Baroshem committed Aug 25, 2021
1 parent ee9931e commit 11df77a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions packages/api-client/__tests__/api/setPaymentMethod.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Context } from '../../src/types';

describe('[vendure-api-client] setPaymentMethod', () => {
it('sets payment method for certain order', async () => {
const givenVariables = { metadata: { id: '1' }, method: 'test' };
const givenVariables = { metadata: {}, method: 'test' };

const context = {
config: {},
Expand All @@ -19,8 +19,10 @@ describe('[vendure-api-client] setPaymentMethod', () => {
extendQuery: (customQuery, args) => args
} as unknown as Context;

const { data } = await setPaymentMethod(context, { metadata: { id: '1' }, method: 'test' });
const { data } = await setPaymentMethod(context, { method: 'test' });

expect(data).toBe('set payment method response');
const expectedSetPaymentResponse = 'set payment method response';

expect(data).toBe(expectedSetPaymentResponse);
});
});
2 changes: 1 addition & 1 deletion packages/theme/pages/Checkout/Payment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export default {
const processOrder = async () => {
const response = await $vendure.api.setPaymentMethod({
method: paymentMethod?.value?.code,
method: paymentMethod?.value?.code
});
const orderId = response?.data?.addPaymentToOrder?.id;
Expand Down

0 comments on commit 11df77a

Please sign in to comment.