From 3ceb30ff9b2dffbd46b7a7610ea570fba0478036 Mon Sep 17 00:00:00 2001 From: Jan Paepke Date: Wed, 13 Dec 2023 12:41:09 +0100 Subject: [PATCH] fixed tests, which require some explanation --- tests/integration/orders.test.ts | 7 ++++--- tests/integration/payments.test.ts | 5 +++-- tests/unit/resources/methods.test.ts | 6 ++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/integration/orders.test.ts b/tests/integration/orders.test.ts index c3f8d198..d1c7bb22 100644 --- a/tests/integration/orders.test.ts +++ b/tests/integration/orders.test.ts @@ -1,12 +1,13 @@ import axios from 'axios'; -import httpAdapter from 'axios/lib/adapters/http'; import dotenv from 'dotenv'; -import createMollieClient, { PaymentMethod, OrderLineType, Locale, OrderEmbed, Payment } from '../..'; +import { fail } from 'node:assert'; + +import createMollieClient, { Locale, OrderEmbed, OrderLineType, Payment, PaymentMethod } from '../..'; /** * Overwrite the default XMLHttpRequestAdapter */ -axios.defaults.adapter = httpAdapter; +axios.defaults.adapter = 'http'; /** * Load the API_KEY environment variable diff --git a/tests/integration/payments.test.ts b/tests/integration/payments.test.ts index c2de13c1..0680f7ca 100644 --- a/tests/integration/payments.test.ts +++ b/tests/integration/payments.test.ts @@ -1,12 +1,13 @@ import axios from 'axios'; -import httpAdapter from 'axios/lib/adapters/http'; import dotenv from 'dotenv'; +import { fail } from 'node:assert'; + import createMollieClient from '../..'; /** * Overwrite the default XMLHttpRequestAdapter */ -axios.defaults.adapter = httpAdapter; +axios.defaults.adapter = 'http'; /** * Load the API_KEY environment variable diff --git a/tests/unit/resources/methods.test.ts b/tests/unit/resources/methods.test.ts index 31855d7c..69940336 100644 --- a/tests/unit/resources/methods.test.ts +++ b/tests/unit/resources/methods.test.ts @@ -22,10 +22,9 @@ describe('methods', () => { mock.onGet(`/methods/${methodId}`).reply(200, response._embedded.methods[0], {}); mock.onGet('/methods/foo').reply(500, error, {}); - it('should return a method instance', done => + it('should return a method instance', () => methods.get(methodId).then(result => { expect(result).toMatchSnapshot(); - done(); })); it('should work with a callback', done => { @@ -36,14 +35,13 @@ describe('methods', () => { }); }); - it('should throw an error for non-existent IDs', done => + it('should throw an error for non-existent IDs', () => methods .get('foo') .then(result => expect(result).toBeUndefined()) .catch(err => { expect(err).toBeInstanceOf(ApiError); expect(err.getMessage()).toEqual(error.detail); - done(); })); it('should return an error with a callback for non-existent IDs', done => {