Giter VIP home page Giter VIP logo

lob-node's Issues

Five failing tests

npm test on 2.10 gives:

  1. Checks create should succeed with inline to address id:
    Uncaught AssertionError: expected { errors:
    [ { message: 'The check service does not support international addresses',
    status_code: 422 } ] } to have property 'id'
    at Assertion.prop.(anonymous function) (/home/somekittens/Dropbox/node/cards/node_modules/should/lib/should.js:61:14)
    at /home/somekittens/Dropbox/node/cards/node_modules/lob/test/checks.js:44:25
    at Request._callback (/home/somekittens/Dropbox/node/cards/node_modules/lob/lib/resources/checks.js:9:2365)
    at Request.self.callback (/home/somekittens/Dropbox/node/cards/node_modules/request/request.js:121:22)
    at Request.EventEmitter.emit (events.js:98:17)
    at Request. (/home/somekittens/Dropbox/node/cards/node_modules/request/request.js:985:14)
    at Request.EventEmitter.emit (events.js:117:20)
    at IncomingMessage. (/home/somekittens/Dropbox/node/cards/node_modules/request/request.js:936:12)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)

  2. Checks get should succeed on get:
    Uncaught AssertionError: expected { errors: [ { message: 'invalid address id', status_code: 404 } ] } to have property 'id'
    at Assertion.prop.(anonymous function) (/home/somekittens/Dropbox/node/cards/node_modules/should/lib/should.js:61:14)
    at /home/somekittens/Dropbox/node/cards/node_modules/lob/test/checks.js:75:27
    at Request._callback (/home/somekittens/Dropbox/node/cards/node_modules/lob/lib/resources/checks.js:9:755)
    at Request.self.callback (/home/somekittens/Dropbox/node/cards/node_modules/request/request.js:121:22)
    at Request.EventEmitter.emit (events.js:98:17)
    at Request. (/home/somekittens/Dropbox/node/cards/node_modules/request/request.js:985:14)
    at Request.EventEmitter.emit (events.js:117:20)
    at IncomingMessage. (/home/somekittens/Dropbox/node/cards/node_modules/request/request.js:936:12)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)

  3. Postcards create should error with bad address:

  Uncaught AssertionError: expected 'invalid address id' to equal 'To address entered could not be found or is invalid'
  + expected - actual

  +"To address entered could not be found or is invalid"
  -"invalid address id"

  at Assertion.prop.(anonymous function) (/home/somekittens/Dropbox/node/cards/node_modules/should/lib/should.js:61:14)
  at /home/somekittens/Dropbox/node/cards/node_modules/lob/test/postcards.js:120:31
  at Request._callback (/home/somekittens/Dropbox/node/cards/node_modules/lob/lib/resources/postcards.js:9:2991)
  at Request.self.callback (/home/somekittens/Dropbox/node/cards/node_modules/request/request.js:121:22)
  at Request.EventEmitter.emit (events.js:98:17)
  at Request.<anonymous> (/home/somekittens/Dropbox/node/cards/node_modules/request/request.js:985:14)
  at Request.EventEmitter.emit (events.js:117:20)
  at IncomingMessage.<anonymous> (/home/somekittens/Dropbox/node/cards/node_modules/request/request.js:936:12)
  at IncomingMessage.EventEmitter.emit (events.js:117:20)
  at _stream_readable.js:920:16
  at process._tickCallback (node.js:415:13)
  1. Postcards create should succeed using address and local file:
    Uncaught TypeError: Cannot read property 'should' of undefined
    at /home/somekittens/Dropbox/node/cards/node_modules/lob/test/postcards.js:136:21
    at Request._callback (/home/somekittens/Dropbox/node/cards/node_modules/lob/lib/resources/postcards.js:9:2991)
    at Request.self.callback (/home/somekittens/Dropbox/node/cards/node_modules/request/request.js:121:22)
    at Request.EventEmitter.emit (events.js:98:17)
    at Request. (/home/somekittens/Dropbox/node/cards/node_modules/request/request.js:985:14)
    at Request.EventEmitter.emit (events.js:117:20)
    at IncomingMessage. (/home/somekittens/Dropbox/node/cards/node_modules/request/request.js:936:12)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)

  2. Postcards create should succeed using address and buffers:
    Uncaught TypeError: Cannot read property 'should' of undefined
    at /home/somekittens/Dropbox/node/cards/node_modules/lob/test/postcards.js:154:21
    at Request._callback (/home/somekittens/Dropbox/node/cards/node_modules/lob/lib/resources/postcards.js:9:2991)
    at Request.self.callback (/home/somekittens/Dropbox/node/cards/node_modules/request/request.js:121:22)
    at Request.EventEmitter.emit (events.js:98:17)
    at Request. (/home/somekittens/Dropbox/node/cards/node_modules/request/request.js:985:14)
    at Request.EventEmitter.emit (events.js:117:20)
    at IncomingMessage. (/home/somekittens/Dropbox/node/cards/node_modules/request/request.js:936:12)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)

Set Host

Take a look at how stripe allows you to set Host. We need a way to override the default host.

Heroku Node Module naming issue

Node module will not work on Heroku. Quick fix is to require it like this:

 var Lob = require('../node_modules/lob/lib/lob');

We need to fix the naming to be all lower case!

Add Jobs Test Cases

  • List (Count and Offset)
  • Get
  • Create
    • Ids
    • Inline Address
    • Inline Object
    • Mixed
    • Multi-Object
    • Local File

Verify doesn't return error with invalid address

Making the following request with Lob API gets a 404 "Address Not Found":

curl https://api.lob.com/v1/verify \
-u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \
-d "address_line1=220 William T Morrissey Boulevard" \
-d "address_city=Boston" \
-d "address_state=Boston" \
-d "address_zip=Boston"

Doing the same with a promisified lob node package gets a "Possibly unhandled from previous event: at Verification.verifyAsync"

connection timeout leads to unhandled exception

In the case of connection timeouts, it is possible for the body argument to a callback to be undefined; the existing code doesn't check for this, and so winds up throwing an unhandled exception. Details of what I've seen below:

Briefly today, we were getting connection timeouts when using the jobs.create() method. When the eventual timeout occurred, it would result in the following unhandled exception:

12:36:27 web.1    | 2015-01-28T17:36:27.661Z - error: [server:24] TypeError: Cannot read property 'errors' of undefined
12:36:27 web.1    |   at Request._callback (/Users/joe/work/realtymaps/map/node_modules/lob/lib/resources/jobs.js:80:13)
12:36:27 web.1    |   at self.callback (/Users/joe/work/realtymaps/map/node_modules/lob/node_modules/request/request.js:373:22)
12:36:27 web.1    |   at Request.emit (events.js:117:20)
12:36:27 web.1    |   at Request.onRequestError (/Users/joe/work/realtymaps/map/node_modules/lob/node_modules/request/request.js:971:8)
12:36:27 web.1    |   at ClientRequest.emit (events.js:95:17)
12:36:27 web.1    |   at CleartextStream.socketCloseListener (http.js:1522:9)
12:36:27 web.1    |   at CleartextStream.emit (events.js:117:20)
12:36:27 web.1    |   at tls.js:693:10
12:36:27 web.1    |   at process._tickCallback (node.js:419:13)

From the error message and looking at jobs.js:80, it seems like a straightforward bug and fix for that particular call (a 1-liner fix was here: https://github.com/lob/lob-node/pull/102/files), but there are lots of other places in the code where the same sort of check should be used.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.