freshbooks-classic
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -84,3 +84,3 @@ "use strict"; | ||
if (!_fp.default.isPlainObject(options) && select && !schema && !actionSchema) { | ||
if (!_fp.default.isPlainObject(options) && select && !schema) { | ||
options = { | ||
@@ -87,0 +87,0 @@ [baseKey]: options |
{ | ||
"name": "freshbooks-classic", | ||
"description": "FreshBooks Classic API wrapper", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"author": "Leonardo Dino", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -44,3 +44,3 @@ import _ from 'lodash/fp' | ||
} | ||
if(!_.isPlainObject(options) && select && !schema && !actionSchema){ | ||
if(!_.isPlainObject(options) && select && !schema){ | ||
options = {[baseKey]: options} | ||
@@ -47,0 +47,0 @@ } |
@@ -74,2 +74,8 @@ import _ from 'lodash' | ||
test.serial('sendByEmail (direct selection)', async t => { | ||
const {estimate} = new FreshBooks(url, token) | ||
const result = await estimate.sendByEmail(estimate_id) | ||
t.true(result, 'returns true') | ||
}) | ||
test.serial('markAsSent', async t => { | ||
@@ -87,2 +93,9 @@ const {estimate} = new FreshBooks(url, token) | ||
test.serial('accept (direct selection)', async t => { | ||
const {estimate} = new FreshBooks(url, token) | ||
const fn = () => estimate.accept(estimate_id) | ||
const e = await t.throws(fn, 'Failed to accept estimate. Estimate is already accepted.') | ||
t.is(e.code, 50020) | ||
}) | ||
test.serial('getPDF', async t => { | ||
@@ -96,2 +109,10 @@ const {estimate} = new FreshBooks(url, token) | ||
test.serial('getPDF (direct selection)', async t => { | ||
const {estimate} = new FreshBooks(url, token) | ||
const result = await estimate.getPDF(estimate_id) | ||
t.true(result instanceof Buffer, 'returns Buffer') | ||
const magic = result.toString('hex', 0, 4) | ||
t.is(magic, '25504446', 'returns PDF File') | ||
}) | ||
test.serial('list', async t => { | ||
@@ -107,10 +128,17 @@ const {estimate} = new FreshBooks(url, token) | ||
test.serial('delete', async t => { | ||
test.serial('delete (direct selection)', async t => { | ||
const {estimate} = new FreshBooks(url, token) | ||
const result = await estimate.delete({estimate_id}) | ||
const result = await estimate.delete(estimate_id) | ||
t.true(result, 'returns true') | ||
}) | ||
test.serial('listAll', async t => { | ||
test.serial('delete', async t => { | ||
const {estimate} = new FreshBooks(url, token) | ||
const fn = () => estimate.delete({estimate_id}) | ||
const e = await t.throws(fn, `'estimate_id' not found. Estimate is deleted.`) | ||
t.is(e.code, 50010) | ||
}) | ||
test('listAll', async t => { | ||
const {estimate} = new FreshBooks(url, token) | ||
const result = await estimate.listAll() | ||
@@ -121,3 +149,3 @@ t.true(_.isArray(result), 'returns array') | ||
test.serial('throw failures', async t => { | ||
test('throw failures', async t => { | ||
const {estimate} = new FreshBooks(url, token) | ||
@@ -124,0 +152,0 @@ await Promise.all([ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
93264
1570