Skip to content

Instantly share code, notes, and snippets.

@lakenen
Created February 1, 2013 18:20
Show Gist options
  • Save lakenen/4693070 to your computer and use it in GitHub Desktop.
Save lakenen/4693070 to your computer and use it in GitHub Desktop.
mocha test results showing 460 passing for crocodoc-node (https://github.com/NetDevLtd/crocodoc-node)
$ make test
NODE_PATH="`pwd`:" ./node_modules/.bin/mocha test/specs | tee test/results/tests.log
path.existsSync is now called `fs.existsSync`.
mocha example (using framework)
Array
#indexOf()
✓ should return -1 when the value is not present
framework
✓ should be a truthy global
✓ should be an object
.assert
✓ should be truthy
✓ should be a function
.url
✓ should be truthy
✓ should be an object
.path
✓ should be truthy
✓ should be an object
.qs
✓ should be truthy
✓ should be an object
.inspect
✓ should be truthy
✓ should be a function
.exec
✓ should be truthy
✓ should be a function
.throwsError
✓ should be truthy
✓ should be a function
.values
✓ should be truthy
✓ should be an object
.invalidParamList
✓ should be truthy
✓ should be an object
.crocodoc
✓ should be truthy
✓ should be an object
.token
✓ should be truthy
✓ should be a string
Crocodoc API: Client Library: base
constructor
✓ should throw an error with no API Token
✓ should throw an error if too many args are passed
✓ should throw errors with invalid API Token parameters
✓ should NOT throw an error with a non-empty API Token string
instance
✓ should have a uriString function
✓ should have a get function
✓ should have a post function
.uriString()
✓ should throw errors with invalid resource parameters
✓ should create the correct uri for a resource (https://crocodoc.com/api/v2/some/resource)
✓ should create a uri from a querystring which starts with the resource URI (https://crocodoc.com/api/v2/some/resource)
✓ should create a uri from a querystring which contains the api token (token=5yS3izG1Rx6OPe0H2hD4mLCv)
✓ should create a uri from a query hash which starts with the resource URI (https://crocodoc.com/api/v2/some/resource)
✓ should create a uri from a query hash which contains the api token (token=5yS3izG1Rx6OPe0H2hD4mLCv)
.get()
✓ should throw an error with no parameters
✓ should throw an error with a resource only, and no callback
✓ should throw an error with a resource only, and a non-function callback
✓ should throw errors with invalid resource parameters only, and a callback
✓ should throw an error with a resource, options, and no callback
✓ should throw an error with a resource, options, and a non-function callback
✓ should throw errors with invalid resource parameters, options, and a callback
✓ should throw an error with a resource, options, an extra parameter, and a callback
.post()
✓ should throw an error with no parameters
✓ should throw an error with a resource only, and no callback
✓ should throw an error with a resource only, and a non-function callback
✓ should throw errors with invalid resource parameters only, and a callback
✓ should throw an error with a resource, options, and no callback
✓ should throw an error with a resource, options, and a non-function callback
✓ should throw errors with invalid resource parameters, options, and a callback
✓ should throw an error with a resource, options, an extra parameter, and a callback
Crocodoc API: Client Library: document
constructor
✓ should throw an error with no API Token
✓ should throw an error if too many params are passed
✓ should throw an error with a undefined param
✓ should throw an error with a null param
✓ should throw an error with a number param
✓ should throw an error with a boolean, true param
✓ should throw an error with a boolean, false param
✓ should throw an error with a object param
✓ should throw an error with a function param
✓ should throw an error with a empty array param
✓ should throw an error with a empty string param
✓ should NOT throw an error with a non-empty API Token string
instance
✓ should have a status function
✓ should have an uploadUrl function
✓ should have an uploadFile function
✓ should have a remove function
✓ should have a poll function
.status()
✓ should throw an error with no parameters
✓ should throw an error with a good uuids param, and no callback
✓ should throw an error with a good uuids param, and a non-function callback
✓ should throw an error with a undefined uuids param, and a function callback
✓ should throw an error with a null uuids param, and a function callback
✓ should throw an error with a number uuids param, and a function callback
✓ should throw an error with a boolean, true uuids param, and a function callback
✓ should throw an error with a boolean, false uuids param, and a function callback
✓ should throw an error with a object uuids param, and a function callback
✓ should throw an error with a function uuids param, and a function callback
✓ should throw an error with a empty array uuids param, and a function callback
✓ should throw an error with a empty string uuids param, and a function callback
✓ should throw an error with a good uuids param, an extra param, and a function callback
.uploadUrl()
✓ should throw an error with no parameters
✓ should throw an error with a good URL param, and no callback
✓ should throw an error with a good URL param, and a non-function callback
✓ should throw an error with a undefined URL param, and a function callback
✓ should throw an error with a null URL param, and a function callback
✓ should throw an error with a number URL param, and a function callback
✓ should throw an error with a boolean, true URL param, and a function callback
✓ should throw an error with a boolean, false URL param, and a function callback
✓ should throw an error with a object URL param, and a function callback
✓ should throw an error with a function URL param, and a function callback
✓ should throw an error with a empty array URL param, and a function callback
✓ should throw an error with a empty string URL param, and a function callback
✓ should throw an error with a good URL param, an extra param, and a function callback
.uploadFile()
✓ should throw an error with no parameters
✓ should throw an error with a good filepath param, and no callback
✓ should throw an error with a good filepath param, and a non-function callback
✓ should throw an error with a undefined filepath param, and a function callback
✓ should throw an error with a null filepath param, and a function callback
✓ should throw an error with a number filepath param, and a function callback
✓ should throw an error with a boolean, true filepath param, and a function callback
✓ should throw an error with a boolean, false filepath param, and a function callback
✓ should throw an error with a object filepath param, and a function callback
✓ should throw an error with a function filepath param, and a function callback
✓ should throw an error with a empty array filepath param, and a function callback
✓ should throw an error with a empty string filepath param, and a function callback
✓ should throw an error with a good filepath param, an extra param, and a function callback
✓ should throw an error with a non-existent file
✓ should throw an error with a directory
✓ should throw an error with an unreadable file
.remove()
✓ should throw an error with no parameters
✓ should throw an error with a good uuid param, and no callback
✓ should throw an error with a good uuid param, and a non-function callback
✓ should throw an error with a undefined uuid param, and a function callback
✓ should throw an error with a null uuid param, and a function callback
✓ should throw an error with a number uuid param, and a function callback
✓ should throw an error with a boolean, true uuid param, and a function callback
✓ should throw an error with a boolean, false uuid param, and a function callback
✓ should throw an error with a object uuid param, and a function callback
✓ should throw an error with a function uuid param, and a function callback
✓ should throw an error with a empty array uuid param, and a function callback
✓ should throw an error with a empty string uuid param, and a function callback
✓ should throw an error with a good uuid param, an extra param, and a function callback
.poll()
✓ should throw an error with no parameters
✓ should throw an error with a good uuid param, and no callback
✓ should throw an error with a good uuid param, and a non-function callback
✓ should throw an error with a undefined uuid param, and a function callback
✓ should throw an error with a null uuid param, and a function callback
✓ should throw an error with a number uuid param, and a function callback
✓ should throw an error with a boolean, true uuid param, and a function callback
✓ should throw an error with a boolean, false uuid param, and a function callback
✓ should throw an error with a object uuid param, and a function callback
✓ should throw an error with a function uuid param, and a function callback
✓ should throw an error with a empty array uuid param, and a function callback
✓ should throw an error with a empty string uuid param, and a function callback
✓ should throw an error with a good uuid param, an extra param, and a function callback
Crocodoc API: Client Library: download
constructor
✓ should throw an error with no API Token
✓ should throw an error if too many args are passed
✓ should throw an error with a undefined param
✓ should throw an error with a null param
✓ should throw an error with a number param
✓ should throw an error with a boolean, true param
✓ should throw an error with a boolean, false param
✓ should throw an error with a object param
✓ should throw an error with a function param
✓ should throw an error with a empty array param
✓ should throw an error with a empty string param
✓ should NOT throw an error with a non-empty API Token string
instance
✓ should have a document function
✓ should have a thumbnail function
✓ should have a text function
.document()
✓ should throw an error with no parameters
✓ should throw an error with a good uuid param, a writeable stream, and no callback
✓ should throw an error with a good uuid param, a writeable stream, and a non-function callback
✓ should throw an error with a undefined uuid param, a writeable stream, and a function callback
✓ should throw an error with a null uuid param, a writeable stream, and a function callback
✓ should throw an error with a number uuid param, a writeable stream, and a function callback
✓ should throw an error with a boolean, true uuid param, a writeable stream, and a function callback
✓ should throw an error with a boolean, false uuid param, a writeable stream, and a function callback
✓ should throw an error with a object uuid param, a writeable stream, and a function callback
✓ should throw an error with a function uuid param, a writeable stream, and a function callback
✓ should throw an error with a empty array uuid param, a writeable stream, and a function callback
✓ should throw an error with a empty string uuid param, a writeable stream, and a function callback
✓ should throw an error with a good uuid param, options, a writeable stream, and no callback
✓ should throw an error with a good uuid param, options, a writeable stream, and a non-function callback
✓ should throw an error with a undefined uuid param, options, a writeable stream, and a function callback
✓ should throw an error with a null uuid param, options, a writeable stream, and a function callback
✓ should throw an error with a number uuid param, options, a writeable stream, and a function callback
✓ should throw an error with a boolean, true uuid param, options, a writeable stream, and a function callback
✓ should throw an error with a boolean, false uuid param, options, a writeable stream, and a function callback
✓ should throw an error with a object uuid param, options, a writeable stream, and a function callback
✓ should throw an error with a function uuid param, options, a writeable stream, and a function callback
✓ should throw an error with a empty array uuid param, options, a writeable stream, and a function callback
✓ should throw an error with a empty string uuid param, options, a writeable stream, and a function callback
✓ should throw an error with a good uuid, options, a writeable stream, an extra param, and a callback
.thumbnail()
✓ should throw an error with no parameters
✓ should throw an error with a good uuid param, a writeable stream, and no callback
✓ should throw an error with a good uuid param, a writeable stream, and a non-function callback
✓ should throw an error with a undefined uuid param, a writeable stream, and a function callback
✓ should throw an error with a null uuid param, a writeable stream, and a function callback
✓ should throw an error with a number uuid param, a writeable stream, and a function callback
✓ should throw an error with a boolean, true uuid param, a writeable stream, and a function callback
✓ should throw an error with a boolean, false uuid param, a writeable stream, and a function callback
✓ should throw an error with a object uuid param, a writeable stream, and a function callback
✓ should throw an error with a function uuid param, a writeable stream, and a function callback
✓ should throw an error with a empty array uuid param, a writeable stream, and a function callback
✓ should throw an error with a empty string uuid param, a writeable stream, and a function callback
✓ should throw an error with a good uuid param, size, a writeable stream, and no callback
✓ should throw an error with a good uuid param, size, a writeable stream, and a non-function callback
✓ should throw an error with a undefined uuid param, size, a writeable stream, and a function callback
✓ should throw an error with a null uuid param, size, a writeable stream, and a function callback
✓ should throw an error with a number uuid param, size, a writeable stream, and a function callback
✓ should throw an error with a boolean, true uuid param, size, a writeable stream, and a function callback
✓ should throw an error with a boolean, false uuid param, size, a writeable stream, and a function callback
✓ should throw an error with a object uuid param, size, a writeable stream, and a function callback
✓ should throw an error with a function uuid param, size, a writeable stream, and a function callback
✓ should throw an error with a empty array uuid param, size, a writeable stream, and a function callback
✓ should throw an error with a empty string uuid param, size, a writeable stream, and a function callback
✓ should throw an error with a good uuid, size, a writeable stream, an extra param, and a callback
.text()
✓ should throw an error with no parameters
✓ should throw an error with a good uuid param, a writeable stream, and no callback
✓ should throw an error with a good uuid param, a writeable stream, and a non-function callback
✓ should throw an error with a undefined uuid param, a writeable stream, and a function callback
✓ should throw an error with a null uuid param, a writeable stream, and a function callback
✓ should throw an error with a number uuid param, a writeable stream, and a function callback
✓ should throw an error with a boolean, true uuid param, a writeable stream, and a function callback
✓ should throw an error with a boolean, false uuid param, a writeable stream, and a function callback
✓ should throw an error with a object uuid param, a writeable stream, and a function callback
✓ should throw an error with a function uuid param, a writeable stream, and a function callback
✓ should throw an error with a empty array uuid param, a writeable stream, and a function callback
✓ should throw an error with a empty string uuid param, a writeable stream, and a function callback
✓ should throw an error with a good uuid, a writeable stream, an extra param, and a callback
Crocodoc API: Client Library: session
constructor
✓ should throw an error with no API Token
✓ should throw an error if too many params are passed
✓ should throw an error with a undefined param
✓ should throw an error with a null param
✓ should throw an error with a number param
✓ should throw an error with a boolean, true param
✓ should throw an error with a boolean, false param
✓ should throw an error with a object param
✓ should throw an error with a function param
✓ should throw an error with a empty array param
✓ should throw an error with a empty string param
✓ should NOT throw an error with a non-empty API Token string
instance
✓ should have a create function
.create()
✓ should throw an error with no parameters
✓ should throw an error with a good uuid param, no options, and no callback
✓ should throw an error with a good uuid param, no options, and a non-function callback
✓ should throw an error with a undefined uuid param, no options, and a function callback
✓ should throw an error with a null uuid param, no options, and a function callback
✓ should throw an error with a number uuid param, no options, and a function callback
✓ should throw an error with a boolean, true uuid param, no options, and a function callback
✓ should throw an error with a boolean, false uuid param, no options, and a function callback
✓ should throw an error with a object uuid param, no options, and a function callback
✓ should throw an error with a function uuid param, no options, and a function callback
✓ should throw an error with a empty array uuid param, no options, and a function callback
✓ should throw an error with a empty string uuid param, no options, and a function callback
✓ should throw an error with a good uuid param, options, and no callback
✓ should throw an error with a good uuid param, options, and a non-function callback
✓ should throw an error with a undefined uuid param, options, and a function callback
✓ should throw an error with a null uuid param, options, and a function callback
✓ should throw an error with a number uuid param, options, and a function callback
✓ should throw an error with a boolean, true uuid param, options, and a function callback
✓ should throw an error with a boolean, false uuid param, options, and a function callback
✓ should throw an error with a object uuid param, options, and a function callback
✓ should throw an error with a function uuid param, options, and a function callback
✓ should throw an error with a empty array uuid param, options, and a function callback
✓ should throw an error with a empty string uuid param, options, and a function callback
✓ should throw an error with a good uuid, options, an extra param, and a callback
Crocodoc API: REST: document
✓ should preload a file without timing out (4204ms)
.status()
with a single uuid for a preloaded file
✓ should respond without timing out (397ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 200 OK response
✓ should have a content-type response header of application/json
the response body
✓ should be an array
✓ should have exactly one member element
the element
✓ should have a non-empty string uuid field
✓ should have an undefined error field
✓ should have a non-empty string status field
✓ should have a boolean viewable field
with a single non-existent uuid in a string
✓ should respond without timing out (394ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 200 OK response
✓ should have a content-type response header of application/json
the response body
✓ should be an array
✓ should have exactly one member element
the element
✓ should have a non-empty uuid string field
✓ should have a truthy error field
with multiple comma separated uuids in a string
✓ should respond without timing out (407ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 200 OK response
✓ should have a content-type response header of application/json
the response body
✓ should be an array
✓ should have the correct number of elements
.uploadUrl()
with a malformed url
✓ should respond without timing out (395ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 200 OK response
✓ should have a content-type response header of application/json
the response body
✓ should have a non-empty uuid string field
the final retrieved status
✓ should poll for a final response without timing out (397ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 200 OK response
✓ should have a content-type response header of application/json
✓ should have a body.status field of "ERROR"
✓ should have a body.viewable field of false
✓ should have a truthy body.error field
with a good url
✓ should respond without timing out (408ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 200 OK response
✓ should have a content-type response header of application/json
the response body
✓ should have a non-empty uuid string field
✓ should have an undefined error field
the final retrieved status
✓ should poll for a final response without timing out (2801ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 200 OK response
✓ should have a content-type response header of application/json
✓ should have a body.status field of "DONE"
✓ should have a body.viewable field of true
✓ should have an undefined body.error field
.uploadFile()
with an unsupported file type
✓ should respond without timing out (398ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 400 response
✓ should have a content-type response header of application/json
the response body
✓ should have an undefined uuid field
✓ should have a truthy error field
with a supported file type
✓ should respond without timing out (795ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 200 OK response
✓ should have a content-type response header of application/json
the response body
✓ should have a non-empty uuid string field
✓ should have an undefined error field
the final retrieved status
✓ should poll for a final response without timing out (5199ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 200 OK response
✓ should have a content-type response header of application/json
✓ should have a body.status field of "DONE"
✓ should have a body.viewable field of true
✓ should have an undefined body.error field
.remove()
with a non-existent uuid
✓ should respond without timing out (396ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 400 response
✓ should have a content-type response header of application/json
the response body
✓ should have an undefined uuid field
✓ should have a truthy error field
with a uuid of a pre-loaded document
✓ should respond without timing out (407ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 200 OK response
✓ should have a content-type response header of application/json
the response body
✓ should be true
Crocodoc API: REST: download
✓ should preload a file without timing out (3617ms)
.document()
with a uuid for a preloaded file
when downloading a pdf
✓ should respond without timing out (465ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 200 OK response
✓ should have a content-type response header which is not application/json
✓ should have created a non-zero sized file
the response body generated by the library
✓ should have a non-empty uuid string field
when downloading the original
✓ should respond without timing out (755ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 200 OK response
✓ should have a content-type response header which is not application/json
✓ should have created a non-zero sized file
the response body generated by the library
✓ should have a non-empty uuid string field
with a non-existent uuid
when downloading a pdf
✓ should respond without timing out (400ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 400 response
✓ should have a content-type response header of application/json
✓ should have created a zero sized file
the response body returned from the API
✓ should have a truthy error field
when downloading the original
✓ should respond without timing out (399ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 400 response
✓ should have a content-type response header of application/json
✓ should have created a zero sized file
the response body returned from the API
✓ should have a truthy error field
.thumbnail()
with a uuid for a preloaded file
✓ should respond without timing out (471ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 200 OK response
✓ should have a content-type response header which is not application/json
✓ should have created a non-zero sized file
the response body generated by the library
✓ should have a non-empty uuid string field
with a non-existent uuid
✓ should respond without timing out (397ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 400 response
✓ should have a content-type response header of application/json
✓ should have created a zero sized file
the response body returned from the API
✓ should have a truthy error field
.text()
with a uuid for a preloaded file
✓ should respond without timing out (454ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 200 OK response
✓ should have a content-type response header which is not application/json
✓ should have created a non-zero sized file
the response body generated by the library
✓ should have a non-empty uuid string field
with a non-existent uuid
✓ should respond without timing out (399ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 400 response
✓ should have a content-type response header of application/json
✓ should have created a zero sized file
the response body returned from the API
✓ should have a truthy error field
Crocodoc API: REST: session
✓ should preload a file without timing out (10814ms)
.create()
with a uuid for a preloaded file
✓ should respond without timing out (398ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 200 OK response
✓ should have a content-type response header of application/json
the response body
✓ should have a non-empty session string field
✓ should have an undefined error field
with a non-existent uuid
✓ should respond without timing out (475ms)
✓ should get a falsey error
✓ should get a truthy response
✓ should have truthy response headers
✓ should get a truthy body
✓ should get a 400 response
✓ should have a content-type response header of application/json
the response body
✓ should have an undefined session field
✓ should have a truthy error field
✔ 460 tests complete (39098ms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment