harvest
Version:
Harvest API client library
35 lines • 1.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const invoicePayments_1 = require("./invoicePayments");
const harvest = {
request: () => {
console.log('Request Made');
}
};
describe('InvoicePayments test', () => {
let instance;
let request;
let id = 1001;
beforeEach(() => {
instance = new invoicePayments_1.InvoicePaymentsAPI(harvest);
request = spyOn(instance.harvest, 'request');
});
it('InvoicePayments is instantiable', () => {
expect(instance).toBeInstanceOf(invoicePayments_1.InvoicePaymentsAPI);
});
it('should have a list method that calls the request method', () => {
const query = { is_active: true };
instance.list(1000, query);
expect(request).toBeCalledWith('GET', '/v2/invoices/1000/payments', query);
});
it('should have an create method that calls the request method', () => {
const data = { property: true };
instance.create(1000, data);
expect(request).toBeCalledWith('POST', '/v2/invoices/1000/payments', data);
});
it('should have a delete method that calls the request method', () => {
instance.delete(1000, id);
expect(request).toBeCalledWith('DELETE', '/v2/invoices/1000/payments/1001');
});
});
//# sourceMappingURL=invoicePayments.spec.js.map