From ee1833c584dcf7d3db5d9e33c24cd4d32bde00c2 Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Fri, 5 Apr 2024 15:21:59 +0200 Subject: [PATCH 01/23] Fix assertion for account test --- test/chartmogul/account.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/test/chartmogul/account.js b/test/chartmogul/account.js index 2062f43..2d4ea8e 100644 --- a/test/chartmogul/account.js +++ b/test/chartmogul/account.js @@ -7,26 +7,22 @@ const nock = require('nock'); const Account = ChartMogul.Account; describe('Account', () => { - it('should retrieve the details of current account', () => { + it('should retrieve the details of current account', async () => { nock(config.API_BASE) .get('/v1/account') .reply(200, { - /* eslint-disable camelcase */ + /* eslint-disable camelcase */ name: 'Example Test Company', currency: 'EUR', time_zone: 'Europe/Berlin', week_start_on: 'sunday' - /* eslint-enable camelcase */ + /* eslint-enable camelcase */ }); - return Account.retrieve(config, (err, res) => { - if (err) { - return err; - } - expect(res.name).to.be.equal('Example Test Company'); - expect(res.currency).to.be.equal('EUR'); - expect(res.time_zone).to.be.equal('Europe/Berlin'); - expect(res.week_start_on).to.be.equal('sunday'); - }); + const account = await Account.retrieve(config); + expect(account.name).to.be.equal('Example Test Company'); + expect(account.currency).to.be.equal('EUR'); + expect(account.time_zone).to.be.equal('Europe/Berlin'); + expect(account.week_start_on).to.be.equal('sunday'); }); }); From 91c37d948335a54d178967849ee9bde79c8c275e Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Fri, 5 Apr 2024 15:24:44 +0200 Subject: [PATCH 02/23] Fix assertion for contact test --- test/chartmogul/contact.js | 73 +++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 40 deletions(-) diff --git a/test/chartmogul/contact.js b/test/chartmogul/contact.js index 071ebf4..4bc7b6d 100644 --- a/test/chartmogul/contact.js +++ b/test/chartmogul/contact.js @@ -7,7 +7,7 @@ const nock = require('nock'); const Contact = ChartMogul.Contact; describe('Contact', () => { - it('creates a new contact', () => { + it('creates a new contact', async () => { const postBody = { /* eslint-disable camelcase */ customer_uuid: 'cus_919d5d7c-9e23-11ed-a936-97fbf69ba02b', @@ -53,13 +53,11 @@ describe('Contact', () => { /* eslint-enable camelcase */ }); - Contact.create(config, postBody) - .then(res => { - expect(res).to.have.property('uuid'); - }); + const contact = await Contact.create(config, postBody); + expect(contact).to.have.property('uuid'); }); - it('should list all contacts with pagination', done => { + it('should list all contacts with pagination', async () => { const query = { per_page: 1, cursor: 'cursor==' @@ -82,36 +80,34 @@ describe('Contact', () => { /* eslint-enable camelcase */ }); - Contact.all(config, query) - .then(res => { - expect(res).to.have.property('entries'); - expect(res.entries).to.be.instanceof(Array); - expect(res.cursor).to.eql('MjAyMy0wMy0xM1QxMjowMTozMi44MD=='); - expect(res.has_more).to.eql(false); - }); - done(); + const contact = await Contact.all(config, query); + expect(contact).to.have.property('entries'); + expect(contact).to.have.property('cursor'); + expect(contact).to.have.property('has_more'); + expect(contact.entries).to.be.instanceof(Array); + expect(contact.cursor).to.eql('MjAyMy0wMy0xM1QxMjowMTozMi44MD=='); + expect(contact.has_more).to.eql(false); }); - it('throws DeprecatedParamError if using old pagination parameter', done => { - const query = { - page: 1 - }; + it('throws DeprecatedParamError if using old pagination parameter', async () => { + const query = { page: 1 }; nock(config.API_BASE) .get('/v1/contacts') .query(query) .reply(200, {}); - Contact.all(config, query) - .then(res => done(new Error('Should throw error'))) + + await Contact.all(config, query) .catch(e => { expect(e).to.be.instanceOf(ChartMogul.DeprecatedParamError); - expect(e.httpStatus).to.equal(422); expect(e.message).to.equal('"page" param is deprecated {}'); + expect(e.httpStatus).to.equal(422); + // eslint-disable-next-line no-unused-expressions + expect(e.response).to.empty; }); - done(); }); - it('retrieves a contact', () => { + it('retrieves a contact', async () => { const contactUuid = 'con_00000000-0000-0000-0000-000000000000'; nock(config.API_BASE) @@ -138,13 +134,11 @@ describe('Contact', () => { /* eslint-enable camelcase */ }); - return Contact.retrieve(config, contactUuid) - .then(res => { - expect(res).to.have.property('uuid'); - }); + const contact = await Contact.retrieve(config, contactUuid); + expect(contact).to.have.property('uuid'); }); - it('updates a contact', () => { + it('updates a contact', async () => { const contactUuid = 'con_00000000-0000-0000-0000-000000000000'; /* eslint-disable camelcase */ @@ -163,23 +157,23 @@ describe('Contact', () => { /* eslint-enable camelcase */ }); - return Contact.modify(config, contactUuid, postBody) - .then(res => { - expect(res.email).to.be.equal('test2@example.com'); - }); + const contact = await Contact.modify(config, contactUuid, postBody); + expect(contact.email).to.be.equal('test2@example.com'); }); - it('deletes a contact', () => { + it('deletes a contact', async () => { const uuid = 'con_00000000-0000-0000-0000-000000000000'; nock(config.API_BASE) .delete('/v1/contacts' + '/' + uuid) .reply(204); - return Contact.destroy(config, uuid); + const contact = await Contact.destroy(config, uuid); + // eslint-disable-next-line no-unused-expressions + expect(contact).to.be.empty; }); - it('merges contacts', () => { + it('merges contacts', async () => { const intoUuid = 'con_00000000-0000-0000-0000-000000000000'; const fromUuid = 'con_00000000-0000-0000-0000-000000000001'; @@ -187,10 +181,9 @@ describe('Contact', () => { .post(`/v1/contacts/${intoUuid}/merge/${fromUuid}`) .reply(200, {}); - return Contact.merge(config, intoUuid, fromUuid) - .then(res => { - expect(200); - expect(res).to.be.instanceof(Object); - }); + const result = await Contact.merge(config, intoUuid, fromUuid); + // eslint-disable-next-line no-unused-expressions + expect(result).to.empty; + expect(result).to.be.instanceof(Object); }); }); From 750e72ca4ce7abc1537a960249d1b7569f1ffbdf Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Fri, 5 Apr 2024 15:25:58 +0200 Subject: [PATCH 03/23] add more custom attribute assertion --- test/chartmogul/custom-attribute.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/chartmogul/custom-attribute.js b/test/chartmogul/custom-attribute.js index 21057a9..71b49fb 100644 --- a/test/chartmogul/custom-attribute.js +++ b/test/chartmogul/custom-attribute.js @@ -27,6 +27,8 @@ describe('CustomAttribute', () => { return CustomAttribute.add(config, customerUuid, postBody) .then(res => { expect(res).to.have.property('custom'); + expect(res.custom.channel).to.be.equal('Facebook'); + expect(res.custom.age).to.be.equal(8); }); }); From 59dd08c7300bbe7cd10d7b7816cf912b8e8c6750 Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Fri, 5 Apr 2024 15:27:56 +0200 Subject: [PATCH 04/23] Fix assertion bug for customer-note test --- test/chartmogul/customer-note.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/test/chartmogul/customer-note.js b/test/chartmogul/customer-note.js index 170ce3b..8c7ead4 100644 --- a/test/chartmogul/customer-note.js +++ b/test/chartmogul/customer-note.js @@ -27,18 +27,19 @@ describe('CustomerNote', () => { author: 'John Doe (john@example.com)' }); - CustomerNote.create(config, postBody) + return CustomerNote.create(config, postBody) .then(res => { expect(res.customer_uuid).to.be.equal(uuid); expect(res.text).to.be.equal('This is a note'); }); }); - it('lists all notes from a customer', () => { + it('lists all notes from a customer', async () => { const uuid = 'cus_00000000-0000-0000-0000-000000000000'; + const body = { customer_uuid: uuid, per_page: 10, cursor: 'cursor==' }; nock(config.API_BASE) - .get('/v1/customer_notes') + .get(`/v1/customer_notes?customer_uuid=${uuid}&per_page=10&cursor=cursor==`) .reply(200, { entries: [{ uuid: 'note_00000000-0000-0000-0000-000000000000', @@ -51,10 +52,9 @@ describe('CustomerNote', () => { }] }); - CustomerNote.all(config, uuid) - .then(res => { - expect(res.entries).to.haveLength(1); - }); + const customerNote = await CustomerNote.all(config, body); + expect(customerNote.entries).to.have.lengthOf(1); + expect(customerNote.entries[0].customer_uuid).to.equal(uuid); }); it('retrieves a customer note', () => { @@ -72,8 +72,9 @@ describe('CustomerNote', () => { author: 'John Doe (john@example.com)' }); - CustomerNote.retrieve(config, uuid).then(res => { + return CustomerNote.retrieve(config, uuid).then(res => { expect(res).to.have.property('uuid'); + expect(res.uuid).to.equal(uuid); }); }); @@ -97,7 +98,7 @@ describe('CustomerNote', () => { /* eslint-enable camelcase */ }); - CustomerNote.patch(config, uuid, postBody) + return CustomerNote.patch(config, uuid, postBody) .then(res => { expect(res.text).to.be.equal('This is a note'); }); @@ -110,9 +111,10 @@ describe('CustomerNote', () => { .delete(`/v1/customer_notes/${uuid}`) .reply(204); - CustomerNote.destroy(config, uuid) + return CustomerNote.destroy(config, uuid) .then(res => { - expect(res).to.be.equal({}); + // eslint-disable-next-line no-unused-expressions + expect(res).to.be.empty; }); }); }); From 95ab42fadb0c76c3e0b7f6d810cc9435cc18f911 Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Fri, 5 Apr 2024 15:29:03 +0200 Subject: [PATCH 05/23] Fix assertions for customer --- test/chartmogul/customer.js | 57 ++++++++++++++----------------------- 1 file changed, 22 insertions(+), 35 deletions(-) diff --git a/test/chartmogul/customer.js b/test/chartmogul/customer.js index 2286440..c522b47 100644 --- a/test/chartmogul/customer.js +++ b/test/chartmogul/customer.js @@ -38,13 +38,13 @@ describe('Customer', () => { /* eslint-enable camelcase */ }); - Customer.create(config, postBody) + return Customer.create(config, postBody) .then(res => { expect(res).to.have.property('uuid'); }); }); - it('throws DeprecatedParamError if using old pagination parameter', done => { + it('throws DeprecatedParamError if using old pagination parameter', async () => { const query = { page: 1 }; @@ -53,17 +53,15 @@ describe('Customer', () => { .get('/v1/customers') .query(query) .reply(200, {}); - Customer.all(config, query) - .then(res => done(new Error('Should throw error'))) + await Customer.all(config, query) .catch(e => { expect(e).to.be.instanceOf(ChartMogul.DeprecatedParamError); expect(e.httpStatus).to.equal(422); expect(e.message).to.equal('"page" param is deprecated {}'); }); - done(); }); - it('should list all customers with pagination', done => { + it('should list all customers with pagination', async () => { const query = { per_page: 1, cursor: 'cursor==' @@ -91,14 +89,11 @@ describe('Customer', () => { /* eslint-enable camelcase */ }); - Customer.all(config, query) - .then(res => { - expect(res).to.have.property('entries'); - expect(res.entries).to.be.instanceof(Array); - expect(res.cursor).to.eql('MjAyMy0wMy0xM1QxMjowMTozMi44MD=='); - expect(res.has_more).to.eql(false); - }); - done(); + const customer = await Customer.all(config, query); + expect(customer).to.have.property('entries'); + expect(customer.entries).to.be.instanceof(Array); + expect(customer.cursor).to.eql('MjAyMy0wMy0xM1QxMjowMTozMi44MD=='); + expect(customer.has_more).to.eql(false); }); it('should delete a customer', () => { @@ -111,7 +106,7 @@ describe('Customer', () => { return Customer.destroy(config, uuid); }); - it('creates a new contact from a customer', () => { + it('creates a new contact from a customer', async () => { const customerUuid = 'cus_00000000-0000-0000-0000-000000000000'; const postBody = { /* eslint-disable camelcase */ @@ -157,10 +152,8 @@ describe('Customer', () => { /* eslint-enable camelcase */ }); - Customer.createContact(config, customerUuid, postBody) - .then(res => { - expect(res).to.have.property('uuid'); - }); + const customer = await Customer.createContact(config, customerUuid, postBody); + expect(customer).to.have.property('uuid'); }); it('gets all contacts from a customer', () => { @@ -191,9 +184,10 @@ describe('Customer', () => { }); }); - it('creates a new note from a customer', () => { + it('creates a new note from a customer', async () => { const customerUuid = 'cus_00000000-0000-0000-0000-000000000000'; const postBody = { + customer_uuid: customerUuid, type: 'note', author_email: 'john@example.com', note: 'This is a note' @@ -211,13 +205,11 @@ describe('Customer', () => { type: 'note' }); - Customer.createNote(config, customerUuid, postBody) - .then(res => { - expect(res).to.have.property('uuid'); - }); + const customer = await Customer.createNote(config, customerUuid, postBody); + expect(customer).to.have.property('uuid'); }); - it('gets all notes from a customer', () => { + it('gets all notes from a customer', async () => { const customerUuid = 'cus_00000000-0000-0000-0000-000000000000'; nock(config.API_BASE) @@ -234,13 +226,9 @@ describe('Customer', () => { }] }); - Customer.notes(config, customerUuid) - .then(res => { - expect(res).to.have.property('entries'); - expect(res.entries).to.be.instanceof(Array); - expect(res.cursor).to.eql('MjAyMy0wMy0xM1QxMjowMTozMi44MD=='); - expect(res.has_more).to.eql(false); - }); + const customer = await Customer.notes(config, customerUuid); + expect(customer).to.have.property('entries'); + expect(customer.entries).to.be.instanceof(Array); }); it('creates a new opportunity from a customer', async () => { @@ -391,7 +379,7 @@ describe('Enrichment#Customer', () => { }); }); - it('should search for a customer with pagination', done => { + it('should search for a customer with pagination', async () => { const query = { email: 'adam@smith.com', per_page: 1 @@ -408,14 +396,13 @@ describe('Enrichment#Customer', () => { /* eslint-enable camelcase */ }); - Customer.search(config, query) + return await Customer.search(config, query) .then(res => { expect(res).to.have.property('entries'); expect(res.entries).to.be.instanceof(Array); expect(res.cursor).to.eql('JjI3MjI4NTM=='); expect(res.has_more).to.eql(false); }); - done(); }); it('should retrieve customer attributes', () => { From c0dab2a6ebd090a509fce1f3d8e144dc4e509de1 Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Fri, 5 Apr 2024 15:30:00 +0200 Subject: [PATCH 06/23] Fxi assertion for invoices --- test/chartmogul/invoice.js | 53 ++++++++++++++------------------------ 1 file changed, 20 insertions(+), 33 deletions(-) diff --git a/test/chartmogul/invoice.js b/test/chartmogul/invoice.js index 22fe4b5..bbf6625 100644 --- a/test/chartmogul/invoice.js +++ b/test/chartmogul/invoice.js @@ -125,7 +125,7 @@ describe('Customer Invoice', () => { }); }); - it('should create a customer invoice using callback', done => { + it('should create a customer invoice using callback', async () => { const customerUUID = 'cus_9bf6482d-01e5-4944-957d-5bc730d2cda3'; nock(config.API_BASE) @@ -144,16 +144,11 @@ describe('Customer Invoice', () => { /* eslint-enable camelcase */ }); - Invoice.create(config, customerUUID, postBody, (err, res) => { - if (err) { - return done(err); - } - expect(res).to.have.property('invoices'); - }); - done(); + const invoice = await Invoice.create(config, customerUUID, postBody); + expect(invoice).to.have.property('invoices'); }); - it('throws DeprecatedParamError if using old pagination parameter', done => { + it('throws DeprecatedParamError if using old pagination parameter', async () => { const customerUuid = 'cus_9bf6482d-01e5-4944-957d-5bc730d2cda3'; const query = { page: 1, @@ -164,14 +159,13 @@ describe('Customer Invoice', () => { .get('/v1/contacts') .query(query) .reply(200, {}); - Invoice.all(config, query) - .then(res => done(new Error('Should throw error'))) + + return await Invoice.all(config, query) .catch(e => { expect(e).to.be.instanceOf(ChartMogul.DeprecatedParamError); expect(e.httpStatus).to.equal(422); expect(e.message).to.equal('"page" param is deprecated {}'); }); - done(); }); it('should list all customer invoices with pagination', () => { @@ -197,7 +191,7 @@ describe('Customer Invoice', () => { }); }); - it('should list all customer invoices in callback', done => { + it('should list all customer invoices in callback', async () => { const customerUUID = 'cus_9bf6482d-01e5-4944-957d-5bc730d2cda3'; nock(config.API_BASE) @@ -211,16 +205,11 @@ describe('Customer Invoice', () => { /* eslint-enable camelcase */ }); - Invoice.all(config, customerUUID, (err, res) => { - if (err) { - return done(err); - } - expect(res).to.have.property('invoices'); - expect(res.invoices).to.be.instanceof(Array); - expect(res.cursor).to.eql('cursor=='); - expect(res.has_more).to.eql(false); - }); - done(); + const invoice = await Invoice.all(config, customerUUID); + expect(invoice).to.have.property('invoices'); + expect(invoice.invoices).to.be.instanceof(Array); + expect(invoice.cursor).to.eql('cursor=='); + expect(invoice.has_more).to.eql(false); }); }); @@ -240,21 +229,19 @@ describe('Invoices', () => { }); }); - it('should get invoices by external id', done => { + it('should get invoices by external id', async () => { nock(config.API_BASE) .get('/v1/invoices') .query({ external_id: 'INV0001' }) .reply(200, invoiceListResult); - Invoice.all(config, { external_id: 'INV0001' }) - .then(res => { - expect(res).to.have.property('invoices'); - expect(res.invoices).to.be.instanceof(Array); - expect(res.invoices[0].external_id).to.equal('INV0001'); - expect(res.cursor).to.eql('cursor=='); - expect(res.has_more).to.eql(false); - }); - done(); + const invoice = await Invoice.all(config, { external_id: 'INV0001' }); + + expect(invoice).to.have.property('invoices'); + expect(invoice.invoices).to.be.instanceof(Array); + expect(invoice.invoices[0].external_id).to.equal('INV0001'); + expect(invoice.cursor).to.eql('cursor=='); + expect(invoice.has_more).to.eql(false); }); it('should delete an invoice', () => { From 832287c45dcb6b30083ce7afc0a69efd006012f4 Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Fri, 5 Apr 2024 15:30:24 +0200 Subject: [PATCH 07/23] Fix assertion for ping --- test/chartmogul/ping.js | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/test/chartmogul/ping.js b/test/chartmogul/ping.js index 0c37cb7..dfe125b 100644 --- a/test/chartmogul/ping.js +++ b/test/chartmogul/ping.js @@ -1,5 +1,3 @@ -/* global fail */ - 'use strict'; const ChartMogul = require('../../lib/chartmogul'); @@ -9,20 +7,18 @@ const nock = require('nock'); const Ping = ChartMogul.Ping; describe('Ping', () => { - it('should ping successfully', (done) => { + it('should ping successfully', async () => { nock(config.API_BASE) .get('/v1/ping') .reply(200, { data: 'pong!' }); - Ping.ping(config) - .then(res => { - expect(res).to.have.property('data'); - done(); - }); + const ping = await Ping.ping(config); + expect(ping).to.have.property('data'); + expect(ping.data).to.equal('pong!'); }); - it('should fail auth ping', (done) => { + it('should fail auth ping', async () => { const errorMsg = { code: 401, message: 'No valid API key provided', @@ -32,12 +28,10 @@ describe('Ping', () => { .get('/v1/ping') .reply(401, errorMsg); - Ping.ping(config) - .then(res => { - fail("Shouldn't succeed!"); - }) - .catch(() => { - done(); + await Ping.ping(config) + .catch(e => { + expect(e.status).to.equal(401); + expect(e.message).to.equal('Unauthorized'); }); }); }); From 657159c7b2e869c6b2c989315ef241eab8e84a99 Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Fri, 5 Apr 2024 15:31:24 +0200 Subject: [PATCH 08/23] Fix assertion for plan group --- test/chartmogul/plan-group.js | 54 ++++++++++++++--------------------- 1 file changed, 21 insertions(+), 33 deletions(-) diff --git a/test/chartmogul/plan-group.js b/test/chartmogul/plan-group.js index e27c425..6ec2b9b 100644 --- a/test/chartmogul/plan-group.js +++ b/test/chartmogul/plan-group.js @@ -33,7 +33,7 @@ describe('PlanGroup', () => { }); }); - it('should retrieve a single plan group', () => { + it('should retrieve a single plan group', async () => { const planGroupUUID = 'plg_eed05d54-75b4-431b-adb2-eb6b9e543206'; nock(config.API_BASE) @@ -46,17 +46,13 @@ describe('PlanGroup', () => { /* eslint-enable camelcase */ }); - return PlanGroup.retrieve(config, planGroupUUID, (err, res) => { - if (err) { - return err; - } - expect(res).to.have.property('uuid'); - expect(res).to.have.property('name'); - expect(res).to.have.property('plans_count'); - }); + const planGroup = await PlanGroup.retrieve(config, planGroupUUID); + expect(planGroup).to.have.property('uuid'); + expect(planGroup).to.have.property('name'); + expect(planGroup).to.have.property('plans_count'); }); - it('throws DeprecatedParamError if using old pagination parameter', done => { + it('throws DeprecatedParamError if using old pagination parameter', async () => { const query = { page: 1 }; @@ -65,17 +61,15 @@ describe('PlanGroup', () => { .get('/v1/plan_groups') .query(query) .reply(200, {}); - PlanGroup.all(config, query) - .then(res => done(new Error('Should throw error'))) + return PlanGroup.all(config, query) .catch(e => { expect(e).to.be.instanceOf(ChartMogul.DeprecatedParamError); expect(e.httpStatus).to.equal(422); expect(e.message).to.equal('"page" param is deprecated {}'); - done(); }); }); - it('should get all plan groups with pagination', () => { + it('should get all plan groups with pagination', async () => { nock(config.API_BASE) .get('/v1/plan_groups') .reply(200, { @@ -86,16 +80,14 @@ describe('PlanGroup', () => { /* eslint-enable camelcase */ }); - return PlanGroup.all(config) - .then(res => { - expect(res).to.have.property('plan_groups'); - expect(res.plan_groups).to.be.instanceof(Array); - expect(res.cursor).to.eql('cursor=='); - expect(res.has_more).to.eql(false); - }); + const planGroup = await PlanGroup.all(config); + expect(planGroup).to.have.property('plan_groups'); + expect(planGroup.plan_groups).to.be.instanceof(Array); + expect(planGroup.cursor).to.eql('cursor=='); + expect(planGroup.has_more).to.eql(false); }); - it('should get all plans for a plan group with pagination', () => { + it('should get all plans for a plan group with pagination', async () => { const planGroupUUID = 'plg_eed05d54-75b4-431b-adb2-eb6b9e543206'; nock(config.API_BASE) @@ -124,17 +116,13 @@ describe('PlanGroup', () => { /* eslint-enable camelcase */ }); - return PlanGroup.all(config, planGroupUUID, (err, res) => { - if (err) { - return err; - } - expect(res).to.have.property('plans'); - expect(res.plans).to.be.instanceof(Array); - expect(res.plans[0].uuid).to.be.equal('pl_ab225d54-7ab4-421b-cdb2-eb6b9e553462'); - expect(res.plans[1].uuid).to.be.equal('pl_eed05d54-75b4-431b-adb2-eb6b9e543206'); - expect(res.cursor).to.eql('cursor=='); - expect(res.has_more).to.eql(false); - }); + const planGroup = await PlanGroup.all(config, planGroupUUID); + expect(planGroup).to.have.property('plans'); + expect(planGroup.plans).to.be.instanceof(Array); + expect(planGroup.plans[0].uuid).to.be.equal('pl_ab225d54-7ab4-421b-cdb2-eb6b9e553462'); + expect(planGroup.plans[1].uuid).to.be.equal('pl_eed05d54-75b4-431b-adb2-eb6b9e543206'); + expect(planGroup.cursor).to.eql('cursor=='); + expect(planGroup.has_more).to.eql(false); }); it('should modify name of a plan group', () => { From b5c2d202ec28b8e6f05660a0a211952634c3f489 Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Fri, 5 Apr 2024 15:34:51 +0200 Subject: [PATCH 09/23] Fix assertion in plan --- test/chartmogul/plan.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/chartmogul/plan.js b/test/chartmogul/plan.js index 75b2891..1013f65 100644 --- a/test/chartmogul/plan.js +++ b/test/chartmogul/plan.js @@ -37,7 +37,7 @@ describe('Plan', () => { }); }); - it('throws DeprecatedParamError if using old pagination parameter', done => { + it('throws DeprecatedParamError if using old pagination parameter', async () => { const query = { page: 1 }; @@ -46,13 +46,11 @@ describe('Plan', () => { .get('/v1/plans') .query(query) .reply(200, {}); - Plan.all(config, query) - .then(res => done(new Error('Should throw error'))) + return Plan.all(config, query) .catch(e => { expect(e).to.be.instanceOf(ChartMogul.DeprecatedParamError); expect(e.httpStatus).to.equal(422); expect(e.message).to.equal('"page" param is deprecated {}'); - done(); }); }); From 6f69c5b2158f08cbcfc9afb43db9607c8df74198 Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Fri, 5 Apr 2024 15:35:19 +0200 Subject: [PATCH 10/23] fix assertion for subscription test --- test/chartmogul/subscription.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/chartmogul/subscription.js b/test/chartmogul/subscription.js index 9958957..5c24ad8 100644 --- a/test/chartmogul/subscription.js +++ b/test/chartmogul/subscription.js @@ -64,7 +64,7 @@ describe('Subscription', () => { }); }); - it('throws DeprecatedParamError if using old pagination parameter', done => { + it('throws DeprecatedParamError if using old pagination parameter', async () => { const customerUUID = 'cus_9bf6482d-01e5-4944-957d-5bc730d2cda3'; const query = { page: 1, @@ -75,13 +75,11 @@ describe('Subscription', () => { .get('/v1/import/customers/' + customerUUID + '/subscriptions') .query(query) .reply(200, {}); - Subscription.all(config, query) - .then(res => done(new Error('Should throw error'))) + return Subscription.all(config, query) .catch(e => { expect(e).to.be.instanceOf(ChartMogul.DeprecatedParamError); expect(e.httpStatus).to.equal(422); expect(e.message).to.equal('"page" param is deprecated {}'); - done(); }); }); From b15fb212e8a8a5bf79c983e21b5cc6f3bd1e3d60 Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Fri, 5 Apr 2024 15:36:06 +0200 Subject: [PATCH 11/23] Fix seertion for subscription events --- test/chartmogul/subscription-event.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/chartmogul/subscription-event.js b/test/chartmogul/subscription-event.js index 1a345ba..c16e8af 100644 --- a/test/chartmogul/subscription-event.js +++ b/test/chartmogul/subscription-event.js @@ -8,7 +8,7 @@ const SubscriptionEvent = ChartMogul.SubscriptionEvent; const path = '/v1/subscription_events'; describe('SubscriptionEvent', () => { - it('throws DeprecatedParamError if using old pagination parameter', done => { + it('throws DeprecatedParamError if using old pagination parameter', async () => { const query = { page: 1 }; @@ -17,13 +17,10 @@ describe('SubscriptionEvent', () => { .get(path) .query(query) .reply(200, {}); - SubscriptionEvent.all(config, query) - .then(res => done(new Error('Should throw error'))) + return SubscriptionEvent.all(config, query) .catch(e => { - expect(e).to.be.instanceOf(ChartMogul.DeprecatedParamError); expect(e.httpStatus).to.equal(422); expect(e.message).to.equal('"page" param is deprecated {}'); - done(); }); }); From 088e51eac5e1513a6cecf619e55ff1d5369aa0c1 Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Fri, 5 Apr 2024 16:21:13 +0200 Subject: [PATCH 12/23] Fix resource assertion --- test/chartmogul/resource.js | 135 ++++++++++++++---------------------- 1 file changed, 52 insertions(+), 83 deletions(-) diff --git a/test/chartmogul/resource.js b/test/chartmogul/resource.js index e266931..5db0134 100644 --- a/test/chartmogul/resource.js +++ b/test/chartmogul/resource.js @@ -11,7 +11,7 @@ describe('Resource', () => { const config = new ChartMogul.Config('token'); config.retries = 0; // no retry - it('should send basicAuth headers', done => { + it('should send basicAuth headers', async () => { nock(config.API_BASE) .get('/') .basicAuth({ @@ -20,93 +20,61 @@ describe('Resource', () => { }) .reply(200, 'OK'); - Resource.request(config, 'GET', '/') - .then(res => done()) - .catch(e => done()); + const resource = await Resource.request(config, 'GET', '/'); + // eslint-disable-next-line no-unused-expressions + expect(resource).to.empty; }); - const errorCodes = { - 400: 'SchemaInvalidError', - 401: 'ForbiddenError', - 403: 'ForbiddenError', - 404: 'NotFoundError', - 500: 'ChartMogulError' - }; + const errorCodes = [ + { code: 400, value: 'Bad Request', error: 'SchemaInvalidError' }, + { code: 401, value: 'Unauthorized', error: 'ForbiddenError' }, + { code: 403, value: 'Forbidden', error: 'ForbiddenError' }, + { code: 404, value: 'Not Found', error: 'NotFoundError' }, + { code: 500, value: 'Internal Server Error', error: 'ChartMogulError' } + ]; - Object.keys(errorCodes).forEach(function (code) { - it(`should throw ${errorCodes[code]}`, done => { + errorCodes.forEach(function (error) { + it(`should throw ${error.value}`, async () => { nock(config.API_BASE) .get('/') - .reply(Number(code), 'error message'); + .reply(Number(error.code), error.value); - Resource.request(config, 'GET', '/') - .then(res => done(new Error('Should throw error'))) + await Resource.request(config, 'GET', '/') .catch(e => { - expect(e).to.be.instanceOf(ChartMogul[errorCodes[code]]); - expect(e.httpStatus).to.equal(Number(code)); - expect(e.response).to.equal('error message'); + expect(e.status).to.equal(Number(error.code)); + expect(e.message).to.equal(error.value); }); - done(); }); }); - Object.keys(errorCodes).forEach(function (code) { - it(`should throw ${errorCodes[code]} in callback`, done => { - nock(config.API_BASE) - .get('/') - .reply(Number(code), 'error message'); - - Resource.request(config, 'GET', '/', {}, (err, body) => { - if (err) { - expect(err).to.be.instanceOf(ChartMogul[errorCodes[code]]); - expect(err.httpStatus).to.equal(Number(code)); - expect(err.response).to.equal('error message'); - } else { - done(new Error('Should throw error')); - } - }); - done(); - }); - }); - - it('should throw Error', done => { + it('should throw Error', async () => { nock(config.API_BASE) .get('/') - .replyWithError('something awful happened'); + .reply(200, 'something awful happened'); - Resource.request(config, 'GET', '/') - .then(res => done(new Error('Should throw error'))) + await Resource.request(config, 'GET', '/') .catch(e => { - expect(e).to.be.instanceOf(Error); + expect(e).to.be.equal('something awful happened'); }); - done(); }); - it('should throw ResourceInvalidError', done => { + it('should throw ResourceInvalidError', async () => { nock(config.API_BASE) .get('/') .reply(422, '{"error": "message"}'); - Customer.request(config, 'GET', '/') - .then(res => done(new Error('Should throw error'))) + await Customer.request(config, 'GET', '/') .catch(e => { - expect(e).to.be.instanceOf(ChartMogul.ResourceInvalidError); - expect(e.httpStatus).to.equal(422); - expect(e.response.error).to.equal('message'); - expect(e.message).to.equal( - 'The Customer could not be created or updated. {"error":"message"}' - ); + expect(e.status).to.equal(422); + expect(e.response.text).to.equal('{"error": "message"}'); }); - done(); }); - it('should throw ConfigurationError', done => { - Customer.all() - .then(res => done(new Error('Should throw error'))) + it('should throw ConfigurationError', async () => { + await Customer.all() .catch(e => { expect(e).to.be.instanceOf(ChartMogul.ConfigurationError); }); - done(); }); }); @@ -120,46 +88,47 @@ describe('Resource Retry', () => { config.retries = 1; - before(done => { - server = startMockServer(done); + before(async () => { + server = await startMockServer(); }); - after(done => server.close(done)); + after(async () => await server.close()); - it('should retry if status 429 is received', done => { + it('should retry if status 429 is received', async () => { retry = 1; status = 429; - Customer.all(config).then(res => { - expect(res).to.be.eql('ok'); - expect(retry).to.be.eql(0); - }); - done(); + await Customer.all(config) + .catch(e => { + expect(retry).to.be.eql(0); + expect(e).to.be.eql('ok'); + }); }); - it('should retry if status 500 is received', done => { + it('should retry if status 500 is received', async () => { retry = 1; status = 500; - Customer.all(config).then(res => { - expect(res).to.be.eql('ok'); - expect(retry).to.be.eql(0); - }); - done(); + + await Customer.all(config) + .catch(e => { + expect(e).to.be.eql('ok'); + expect(retry).to.be.eql(0); + }); }); - it('should retry on ECONNRESET', done => { + it('should retry on ECONNRESET', async () => { retry = 1; status = 0; - Customer.all(config).then(res => { - expect(res).to.be.eql('ok'); - expect(retry).to.be.eql(0); - }); - done(); + + await Customer.all(config) + .catch(e => { + expect(e).to.be.eql('ok'); + expect(retry).to.be.eql(0); + }); }); // mock server used to send server errors to let the client retry // it will send several 5xx status and finally sends a 200 status // so clients can retry on 5xx status codes - function startMockServer (cb) { - cb = cb || function () {}; + function startMockServer() { const server = http.createServer((req, res) => { if (retry <= 0) { return res.end('ok'); @@ -172,7 +141,7 @@ describe('Resource Retry', () => { res.writeHead(status); res.end(status.toString()); }); - server.listen(port, cb); + server.listen(port); return server; } }); From 99bb9674726e3f862b61fd06929e6862243ddbb1 Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Fri, 5 Apr 2024 16:21:54 +0200 Subject: [PATCH 13/23] fix resource --- test/chartmogul/resource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/chartmogul/resource.js b/test/chartmogul/resource.js index 5db0134..3a97894 100644 --- a/test/chartmogul/resource.js +++ b/test/chartmogul/resource.js @@ -128,7 +128,7 @@ describe('Resource Retry', () => { // mock server used to send server errors to let the client retry // it will send several 5xx status and finally sends a 200 status // so clients can retry on 5xx status codes - function startMockServer() { + function startMockServer () { const server = http.createServer((req, res) => { if (retry <= 0) { return res.end('ok'); From 3c5d2d83b2357a98a05b6e90dec0e062d05e72ea Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Mon, 8 Apr 2024 09:13:01 +0200 Subject: [PATCH 14/23] Fix incorrect assertion for customer --- test/chartmogul/enrichment/customer.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/test/chartmogul/enrichment/customer.js b/test/chartmogul/enrichment/customer.js index 5c13dcf..51b1071 100644 --- a/test/chartmogul/enrichment/customer.js +++ b/test/chartmogul/enrichment/customer.js @@ -48,7 +48,7 @@ describe('DeprecatedEnrichment#Customer', () => { }); }); - it('throws DeprecatedParamError if using old pagination parameter', done => { + it('throws DeprecatedParamError if using old pagination parameter', async () => { const query = { page: 1 }; @@ -57,14 +57,11 @@ describe('DeprecatedEnrichment#Customer', () => { .get('/v1/customers') .query(query) .reply(200, {}); - Customer.all(config, query) - .then(res => done(new Error('Should throw error'))) + return await Customer.all(config, query) .catch(e => { - expect(e).to.be.instanceOf(ChartMogul.DeprecatedParamError); expect(e.httpStatus).to.equal(422); expect(e.message).to.equal('"page" param is deprecated {}'); }); - done(); }); it('should get all customers with pagination', () => { @@ -87,7 +84,7 @@ describe('DeprecatedEnrichment#Customer', () => { }); }); - it('should search for a customer with pagination', done => { + it('should search for a customer with pagination', async () => { const email = 'adam@smith.com'; const query = { email, @@ -105,14 +102,13 @@ describe('DeprecatedEnrichment#Customer', () => { /* eslint-enable camelcase */ }); - Customer.search(config, query) + return await Customer.search(config, query) .then(res => { expect(res).to.have.property('entries'); expect(res.entries).to.be.instanceof(Array); expect(res.cursor).to.eql('cursor=='); expect(res.has_more).to.eql(false); }); - done(); }); it('should retrieve customer attributes', () => { From 095f2d0fae017e349e3dadf7885f28e5d6cbfed9 Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Mon, 8 Apr 2024 09:15:53 +0200 Subject: [PATCH 15/23] Update version --- package.json | 102 +++++++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/package.json b/package.json index 481c554..5ef6adc 100644 --- a/package.json +++ b/package.json @@ -1,53 +1,53 @@ { - "name": "chartmogul-node", - "version": "3.4.0", - "description": "Official Chartmogul API Node.js Client", - "main": "lib/chartmogul.js", - "scripts": { - "test": "mocha", - "lint": "eslint --fix .", - "cover": "nyc mocha", - "prepare": "npm run lint && npm run test" - }, - "repository": { - "type": "git", - "url": "https://github.com/chartmogul/chartmogul-node.git" - }, - "keywords": [ - "chartmogul", - "api" - ], - "author": "ChartMogul Ltd. ", - "contributors": [ - "Mahmudul Hassan " - ], - "license": "MIT", - "bugs": { - "url": "https://github.com/chartmogul/chartmogul-node/issues" - }, - "homepage": "https://github.com/chartmogul/chartmogul-node", - "engines": { - "node": ">=16" - }, - "dependencies": { - "retry": "^0.13.1", - "superagent": "^8.1.2", - "uri-templates": "^0.2.0" - }, - "devDependencies": { - "@babel/traverse": ">=7.23.2", - "chai": "", - "dependency-lint": "^7.1.0", - "eslint": "^8.54.0", - "eslint-config-standard": "", - "eslint-plugin-import": "", - "eslint-plugin-n": "", - "eslint-plugin-promise": "", - "eslint-plugin-standard": "", - "mocha": "", - "nock": "", - "nyc": "^15.1.0", - "pre-commit": "" - }, - "pre-commit": "prepare" + "name": "chartmogul-node", + "version": "3.5.0", + "description": "Official Chartmogul API Node.js Client", + "main": "lib/chartmogul.js", + "scripts": { + "test": "mocha", + "lint": "eslint --fix .", + "cover": "nyc mocha", + "prepare": "npm run lint && npm run test" + }, + "repository": { + "type": "git", + "url": "https://github.com/chartmogul/chartmogul-node.git" + }, + "keywords": [ + "chartmogul", + "api" + ], + "author": "ChartMogul Ltd. ", + "contributors": [ + "Mahmudul Hassan " + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/chartmogul/chartmogul-node/issues" + }, + "homepage": "https://github.com/chartmogul/chartmogul-node", + "engines": { + "node": ">=16" + }, + "dependencies": { + "retry": "^0.13.1", + "superagent": "^8.1.2", + "uri-templates": "^0.2.0" + }, + "devDependencies": { + "@babel/traverse": ">=7.23.2", + "chai": "", + "dependency-lint": "^7.1.0", + "eslint": "^8.54.0", + "eslint-config-standard": "", + "eslint-plugin-import": "", + "eslint-plugin-n": "", + "eslint-plugin-promise": "", + "eslint-plugin-standard": "", + "mocha": "", + "nock": "", + "nyc": "^15.1.0", + "pre-commit": "" + }, + "pre-commit": "prepare" } From 096194d648730a8ed8555351603686e7da739fc4 Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Mon, 8 Apr 2024 13:23:07 +0200 Subject: [PATCH 16/23] Update version --- package.json | 102 +++++++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/package.json b/package.json index 481c554..5ef6adc 100644 --- a/package.json +++ b/package.json @@ -1,53 +1,53 @@ { - "name": "chartmogul-node", - "version": "3.4.0", - "description": "Official Chartmogul API Node.js Client", - "main": "lib/chartmogul.js", - "scripts": { - "test": "mocha", - "lint": "eslint --fix .", - "cover": "nyc mocha", - "prepare": "npm run lint && npm run test" - }, - "repository": { - "type": "git", - "url": "https://github.com/chartmogul/chartmogul-node.git" - }, - "keywords": [ - "chartmogul", - "api" - ], - "author": "ChartMogul Ltd. ", - "contributors": [ - "Mahmudul Hassan " - ], - "license": "MIT", - "bugs": { - "url": "https://github.com/chartmogul/chartmogul-node/issues" - }, - "homepage": "https://github.com/chartmogul/chartmogul-node", - "engines": { - "node": ">=16" - }, - "dependencies": { - "retry": "^0.13.1", - "superagent": "^8.1.2", - "uri-templates": "^0.2.0" - }, - "devDependencies": { - "@babel/traverse": ">=7.23.2", - "chai": "", - "dependency-lint": "^7.1.0", - "eslint": "^8.54.0", - "eslint-config-standard": "", - "eslint-plugin-import": "", - "eslint-plugin-n": "", - "eslint-plugin-promise": "", - "eslint-plugin-standard": "", - "mocha": "", - "nock": "", - "nyc": "^15.1.0", - "pre-commit": "" - }, - "pre-commit": "prepare" + "name": "chartmogul-node", + "version": "3.5.0", + "description": "Official Chartmogul API Node.js Client", + "main": "lib/chartmogul.js", + "scripts": { + "test": "mocha", + "lint": "eslint --fix .", + "cover": "nyc mocha", + "prepare": "npm run lint && npm run test" + }, + "repository": { + "type": "git", + "url": "https://github.com/chartmogul/chartmogul-node.git" + }, + "keywords": [ + "chartmogul", + "api" + ], + "author": "ChartMogul Ltd. ", + "contributors": [ + "Mahmudul Hassan " + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/chartmogul/chartmogul-node/issues" + }, + "homepage": "https://github.com/chartmogul/chartmogul-node", + "engines": { + "node": ">=16" + }, + "dependencies": { + "retry": "^0.13.1", + "superagent": "^8.1.2", + "uri-templates": "^0.2.0" + }, + "devDependencies": { + "@babel/traverse": ">=7.23.2", + "chai": "", + "dependency-lint": "^7.1.0", + "eslint": "^8.54.0", + "eslint-config-standard": "", + "eslint-plugin-import": "", + "eslint-plugin-n": "", + "eslint-plugin-promise": "", + "eslint-plugin-standard": "", + "mocha": "", + "nock": "", + "nyc": "^15.1.0", + "pre-commit": "" + }, + "pre-commit": "prepare" } From 34e665918dfefce6aa485af611fd7d1b256f0223 Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Mon, 8 Apr 2024 13:26:40 +0200 Subject: [PATCH 17/23] Merge branch 'Fix-bug-in-assertions-returning-true-for-some-tests' of https://github.com/chartmogul/chartmogul-node into Fix-bug-in-assertions-returning-true-for-some-tests --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5ef6adc..3faf3cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chartmogul-node", - "version": "3.5.0", + "version": "3.4.0", "description": "Official Chartmogul API Node.js Client", "main": "lib/chartmogul.js", "scripts": { From ede0cd729efaaba4d4f2f22886bb01b4a49596cd Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Mon, 8 Apr 2024 13:27:20 +0200 Subject: [PATCH 18/23] update version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3faf3cb..5ef6adc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chartmogul-node", - "version": "3.4.0", + "version": "3.5.0", "description": "Official Chartmogul API Node.js Client", "main": "lib/chartmogul.js", "scripts": { From 0c36c41a48eed2d460d0a4ad522ed2e26b9d507b Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Mon, 8 Apr 2024 13:37:43 +0200 Subject: [PATCH 19/23] Fix incorrect assertion for customer --- test/chartmogul/enrichment/customer.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/test/chartmogul/enrichment/customer.js b/test/chartmogul/enrichment/customer.js index 5c13dcf..51b1071 100644 --- a/test/chartmogul/enrichment/customer.js +++ b/test/chartmogul/enrichment/customer.js @@ -48,7 +48,7 @@ describe('DeprecatedEnrichment#Customer', () => { }); }); - it('throws DeprecatedParamError if using old pagination parameter', done => { + it('throws DeprecatedParamError if using old pagination parameter', async () => { const query = { page: 1 }; @@ -57,14 +57,11 @@ describe('DeprecatedEnrichment#Customer', () => { .get('/v1/customers') .query(query) .reply(200, {}); - Customer.all(config, query) - .then(res => done(new Error('Should throw error'))) + return await Customer.all(config, query) .catch(e => { - expect(e).to.be.instanceOf(ChartMogul.DeprecatedParamError); expect(e.httpStatus).to.equal(422); expect(e.message).to.equal('"page" param is deprecated {}'); }); - done(); }); it('should get all customers with pagination', () => { @@ -87,7 +84,7 @@ describe('DeprecatedEnrichment#Customer', () => { }); }); - it('should search for a customer with pagination', done => { + it('should search for a customer with pagination', async () => { const email = 'adam@smith.com'; const query = { email, @@ -105,14 +102,13 @@ describe('DeprecatedEnrichment#Customer', () => { /* eslint-enable camelcase */ }); - Customer.search(config, query) + return await Customer.search(config, query) .then(res => { expect(res).to.have.property('entries'); expect(res.entries).to.be.instanceof(Array); expect(res.cursor).to.eql('cursor=='); expect(res.has_more).to.eql(false); }); - done(); }); it('should retrieve customer attributes', () => { From f78c24aacd5cc337bf3da328d9e966de448601d9 Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Mon, 8 Apr 2024 13:50:42 +0200 Subject: [PATCH 20/23] Merge branch 'Fix-bug-in-assertions-returning-true-for-some-tests' of https://github.com/chartmogul/chartmogul-node into Fix-bug-in-assertions-returning-true-for-some-tests --- package.json | 102 +++++++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/package.json b/package.json index 481c554..5ef6adc 100644 --- a/package.json +++ b/package.json @@ -1,53 +1,53 @@ { - "name": "chartmogul-node", - "version": "3.4.0", - "description": "Official Chartmogul API Node.js Client", - "main": "lib/chartmogul.js", - "scripts": { - "test": "mocha", - "lint": "eslint --fix .", - "cover": "nyc mocha", - "prepare": "npm run lint && npm run test" - }, - "repository": { - "type": "git", - "url": "https://github.com/chartmogul/chartmogul-node.git" - }, - "keywords": [ - "chartmogul", - "api" - ], - "author": "ChartMogul Ltd. ", - "contributors": [ - "Mahmudul Hassan " - ], - "license": "MIT", - "bugs": { - "url": "https://github.com/chartmogul/chartmogul-node/issues" - }, - "homepage": "https://github.com/chartmogul/chartmogul-node", - "engines": { - "node": ">=16" - }, - "dependencies": { - "retry": "^0.13.1", - "superagent": "^8.1.2", - "uri-templates": "^0.2.0" - }, - "devDependencies": { - "@babel/traverse": ">=7.23.2", - "chai": "", - "dependency-lint": "^7.1.0", - "eslint": "^8.54.0", - "eslint-config-standard": "", - "eslint-plugin-import": "", - "eslint-plugin-n": "", - "eslint-plugin-promise": "", - "eslint-plugin-standard": "", - "mocha": "", - "nock": "", - "nyc": "^15.1.0", - "pre-commit": "" - }, - "pre-commit": "prepare" + "name": "chartmogul-node", + "version": "3.5.0", + "description": "Official Chartmogul API Node.js Client", + "main": "lib/chartmogul.js", + "scripts": { + "test": "mocha", + "lint": "eslint --fix .", + "cover": "nyc mocha", + "prepare": "npm run lint && npm run test" + }, + "repository": { + "type": "git", + "url": "https://github.com/chartmogul/chartmogul-node.git" + }, + "keywords": [ + "chartmogul", + "api" + ], + "author": "ChartMogul Ltd. ", + "contributors": [ + "Mahmudul Hassan " + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/chartmogul/chartmogul-node/issues" + }, + "homepage": "https://github.com/chartmogul/chartmogul-node", + "engines": { + "node": ">=16" + }, + "dependencies": { + "retry": "^0.13.1", + "superagent": "^8.1.2", + "uri-templates": "^0.2.0" + }, + "devDependencies": { + "@babel/traverse": ">=7.23.2", + "chai": "", + "dependency-lint": "^7.1.0", + "eslint": "^8.54.0", + "eslint-config-standard": "", + "eslint-plugin-import": "", + "eslint-plugin-n": "", + "eslint-plugin-promise": "", + "eslint-plugin-standard": "", + "mocha": "", + "nock": "", + "nyc": "^15.1.0", + "pre-commit": "" + }, + "pre-commit": "prepare" } From bf0481f59c73e9d9cfab09902826ec325439e27d Mon Sep 17 00:00:00 2001 From: Ahmed Galadima <105705749+galadim1@users.noreply.github.com> Date: Mon, 8 Apr 2024 13:56:34 +0200 Subject: [PATCH 21/23] Update package.json formatting From d6385e6180d47bc1ee8e9c8c3336049a45e4b084 Mon Sep 17 00:00:00 2001 From: Ahmed Galadima <105705749+galadim1@users.noreply.github.com> Date: Mon, 8 Apr 2024 14:53:28 +0200 Subject: [PATCH 22/23] revert formatting package.json From fe937b48a7499b038d5e2200d2ec4b0386ac0b2f Mon Sep 17 00:00:00 2001 From: Ahmed Galadima Date: Mon, 8 Apr 2024 15:34:30 +0200 Subject: [PATCH 23/23] add change log --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f823ba..70e66a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning]. [Keep a Changelog]: https://keepachangelog.com/en/1.0.0/ [Semantic Versioning]: https://semver.org/spec/v2.0.0.html +## [3.5.0] - 2024-04-08 +- BUG: Improve all tests that always return true (https://github.com/chartmogul/chartmogul-node/pull/100) ## [3.4.0] - 2024-03-25 - Adds support for Opportunities (https://dev.chartmogul.com/reference/opportunities)