freezerwatch 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/freezerwatch +9 -0
- data/bin/setup +7 -0
- data/freezerwatch.gemspec +23 -0
- data/lib/freezerwatch.rb +5 -0
- data/lib/freezerwatch/version.rb +3 -0
- data/node_modules/.bin/freezerwatch +139 -0
- data/node_modules/freezerwatch/.npmignore +3 -0
- data/node_modules/freezerwatch/.ruby-version +1 -0
- data/node_modules/freezerwatch/Gemfile +4 -0
- data/node_modules/freezerwatch/Gemfile.lock +79 -0
- data/node_modules/freezerwatch/LICENSE +23 -0
- data/node_modules/freezerwatch/README.md +41 -0
- data/node_modules/freezerwatch/Rakefile +13 -0
- data/node_modules/freezerwatch/freezerwatch.js +139 -0
- data/node_modules/freezerwatch/metrics/bigfiles_high_water_mark +1 -0
- data/node_modules/freezerwatch/metrics/cane_high_water_mark +1 -0
- data/node_modules/freezerwatch/metrics/flay_high_water_mark +1 -0
- data/node_modules/freezerwatch/metrics/flog_high_water_mark +1 -0
- data/node_modules/freezerwatch/metrics/punchlist_high_water_mark +2 -0
- data/node_modules/freezerwatch/metrics/reek_high_water_mark +1 -0
- data/node_modules/freezerwatch/metrics/rubocop_high_water_mark +1 -0
- data/node_modules/freezerwatch/node_modules/async/.jshintrc +25 -0
- data/node_modules/freezerwatch/node_modules/async/.travis.yml +6 -0
- data/node_modules/freezerwatch/node_modules/async/CHANGELOG.md +65 -0
- data/node_modules/freezerwatch/node_modules/async/LICENSE +19 -0
- data/node_modules/freezerwatch/node_modules/async/README.md +1803 -0
- data/node_modules/freezerwatch/node_modules/async/bower.json +43 -0
- data/node_modules/freezerwatch/node_modules/async/component.json +17 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/base.css +182 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/index.html +73 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/base.css +182 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/index.html +73 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/lib/async.js.html +3900 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/lib/index.html +73 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/prettify.css +1 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/prettify.js +1 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/sorter.js +156 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov.info +1452 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lib/async.js.html +3597 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lib/index.html +73 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/prettify.css +1 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/prettify.js +1 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/sort-arrow-sprite.png +0 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/sorter.js +156 -0
- data/node_modules/freezerwatch/node_modules/async/lib/async.js +1191 -0
- data/node_modules/freezerwatch/node_modules/async/nyc_output/5074.json +1 -0
- data/node_modules/freezerwatch/node_modules/async/package.json +96 -0
- data/node_modules/freezerwatch/node_modules/async/support/sync-package-managers.js +53 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/.npmignore +15 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/Client.js +60 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/Device.js +38 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/DeviceRawReadStream.js +36 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/DeviceSingleRawReadStream.js +29 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/DeviceStream.js +35 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/LICENSE +23 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/README.md +25 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/index.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/.npmignore +2 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/.travis.yml +12 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/LICENSE +55 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/README.md +364 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/index.js +156 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/lib/copy.js +8 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/lib/debug.js +7 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/lib/getSafe.js +34 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/lib/optional.js +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/.bin/uuid +26 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/aws-sign2/LICENSE +55 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/aws-sign2/README.md +4 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/aws-sign2/index.js +202 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/aws-sign2/package.json +46 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/forever-agent/LICENSE +55 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/forever-agent/README.md +4 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/forever-agent/index.js +119 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/forever-agent/package.json +45 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/License +19 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/Readme.md +175 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/lib/form_data.js +351 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/.travis.yml +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/LICENSE +19 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/README.md +1647 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/bower.json +38 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/component.json +16 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js +1123 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/package.json +84 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/support/sync-package-managers.js +53 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/License +19 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md +132 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js +188 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/.npmignore +2 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License +19 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile +7 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md +154 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js +99 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json +42 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js +6 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js +38 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js +21 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js +14 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js +48 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js +15 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js +13 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js +13 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js +7 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json +60 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/package.json +80 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/.npmignore +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/.travis.yml +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/LICENSE +24 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/Makefile +10 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/README.md +627 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/example/usage.js +78 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/images/hawk.png +0 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/images/logo.png +0 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/index.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/browser.js +485 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/client.js +367 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/crypto.js +111 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/index.js +15 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/server.js +524 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/utils.js +183 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/.npmignore +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/.travis.yml +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/LICENSE +24 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/Makefile +11 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/README.md +6 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/images/boom.png +0 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/index.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js +207 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/package.json +64 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/test/index.js +245 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/.npmignore +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/.travis.yml +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/LICENSE +24 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/Makefile +11 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/README.md +6 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/index.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/lib/index.js +68 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/package.json +65 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/test/index.js +101 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/.npmignore +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/.travis.yml +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/LICENSE +33 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/Makefile +10 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/README.md +436 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/images/hoek.png +0 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/index.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/lib/escape.js +132 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/lib/index.js +585 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/package.json +70 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/escaper.js +86 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/index.js +1078 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test1.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test2.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test3.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/.npmignore +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/.travis.yml +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/LICENSE +24 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/Makefile +11 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/README.md +68 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/examples/offset.js +16 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/examples/time.js +25 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/index.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js +409 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/package.json +65 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/test/index.js +359 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/package.json +70 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/browser.js +771 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/client.js +206 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/crypto.js +86 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/index.js +316 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/message.js +246 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/readme.js +98 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/server.js +686 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/uri.js +456 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/utils.js +120 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/.dir-locals.el +6 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/.npmignore +7 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/LICENSE +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/README.md +79 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/http_signing.md +296 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/index.js +26 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/parser.js +304 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/signer.js +178 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/util.js +304 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/verify.js +42 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/.npmignore +2 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE +19 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/README.md +50 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js +13 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js +27 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js +267 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js +36 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js +317 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js +20 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json +63 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js +172 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js +296 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/assert-plus/README.md +126 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js +245 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/assert-plus/package.json +45 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/.npmignore +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG +78 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE +24 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/README +82 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/README.old +298 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/ctf.js +245 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js +1485 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/ctype.js +944 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/man/man3ctype/ctio.3ctype +241 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/package.json +42 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsl.conf +129 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsstyle +839 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/package.json +72 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/.npmignore +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/CHANGELOG.md +14 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/LICENSE +15 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/Makefile +35 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/README.md +52 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/package.json +68 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/stringify.js +27 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/test/mocha.opts +2 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/test/stringify_test.js +246 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/LICENSE +19 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/README.md +66 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/mime.js +114 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/package.json +57 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/test.js +84 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/types/mime.types +1588 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/types/node.types +77 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/.npmignore +2 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/LICENSE.md +21 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/README.md +243 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/README.md +53 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/bench.gnu +174 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/bench.sh +34 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/benchmark-native.c +34 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/benchmark.js +84 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/bin/uuid +26 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/bower.json +23 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/component.json +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/package.json +65 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/test/compare_v1.js +63 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/test/test.html +17 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/test/test.js +228 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/uuid.js +247 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/LICENSE +55 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/README.md +4 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/index.js +43 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/package.json +48 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/test.js +49 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/.gitmodules +6 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/.npmignore +7 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/Readme.md +58 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/index.js +366 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/package.json +55 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/.jshintrc +72 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/.npmignore +3 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/LICENSE +78 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/README.md +380 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/generate-pubsuffix.js +230 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/lib/cookie.js +947 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/lib/memstore.js +102 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/lib/pubsuffix.js +69 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/node_modules/punycode/LICENSE-MIT.txt +20 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/node_modules/punycode/README.md +176 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/node_modules/punycode/package.json +81 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/node_modules/punycode/punycode.js +530 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/package.json +63 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/public-suffix.txt +5229 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/test.js +1340 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tunnel-agent/LICENSE +55 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tunnel-agent/README.md +4 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tunnel-agent/index.js +227 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tunnel-agent/package.json +45 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/package.json +74 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/request.js +1244 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/package.json +34 -0
- data/node_modules/freezerwatch/node_modules/optparse/README.md +163 -0
- data/node_modules/freezerwatch/node_modules/optparse/TODO +1 -0
- data/node_modules/freezerwatch/node_modules/optparse/examples/browser-test.html +75 -0
- data/node_modules/freezerwatch/node_modules/optparse/examples/nodejs-test.js +86 -0
- data/node_modules/freezerwatch/node_modules/optparse/lib/optparse.js +309 -0
- data/node_modules/freezerwatch/node_modules/optparse/package.json +46 -0
- data/node_modules/freezerwatch/node_modules/optparse/seed.yml +5 -0
- data/node_modules/freezerwatch/node_modules/osenv/.npmignore +13 -0
- data/node_modules/freezerwatch/node_modules/osenv/.travis.yml +9 -0
- data/node_modules/freezerwatch/node_modules/osenv/LICENSE +15 -0
- data/node_modules/freezerwatch/node_modules/osenv/README.md +63 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-homedir/index.js +24 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-homedir/license +21 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-homedir/package.json +70 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-homedir/readme.md +33 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-tmpdir/index.js +25 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-tmpdir/license +21 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-tmpdir/package.json +70 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-tmpdir/readme.md +36 -0
- data/node_modules/freezerwatch/node_modules/osenv/osenv.js +72 -0
- data/node_modules/freezerwatch/node_modules/osenv/package.json +76 -0
- data/node_modules/freezerwatch/node_modules/osenv/test/unix.js +71 -0
- data/node_modules/freezerwatch/node_modules/osenv/test/windows.js +74 -0
- data/node_modules/freezerwatch/node_modules/osenv/x.tap +39 -0
- data/node_modules/freezerwatch/package.json +37 -0
- metadata +384 -0
@@ -0,0 +1,70 @@
|
|
1
|
+
{
|
2
|
+
"name": "hoek",
|
3
|
+
"description": "General purpose node utilities",
|
4
|
+
"version": "0.9.1",
|
5
|
+
"author": {
|
6
|
+
"name": "Eran Hammer",
|
7
|
+
"email": "eran@hueniverse.com",
|
8
|
+
"url": "http://hueniverse.com"
|
9
|
+
},
|
10
|
+
"contributors": [
|
11
|
+
{
|
12
|
+
"name": "Van Nguyen",
|
13
|
+
"email": "the.gol.effect@gmail.com"
|
14
|
+
}
|
15
|
+
],
|
16
|
+
"repository": {
|
17
|
+
"type": "git",
|
18
|
+
"url": "git://github.com/spumko/hoek.git"
|
19
|
+
},
|
20
|
+
"main": "index",
|
21
|
+
"keywords": [
|
22
|
+
"utilities"
|
23
|
+
],
|
24
|
+
"engines": {
|
25
|
+
"node": ">=0.8.0"
|
26
|
+
},
|
27
|
+
"dependencies": {},
|
28
|
+
"devDependencies": {
|
29
|
+
"lab": "0.1.x",
|
30
|
+
"complexity-report": "0.x.x"
|
31
|
+
},
|
32
|
+
"scripts": {
|
33
|
+
"test": "make test-cov"
|
34
|
+
},
|
35
|
+
"licenses": [
|
36
|
+
{
|
37
|
+
"type": "BSD",
|
38
|
+
"url": "http://github.com/spumko/hoek/raw/master/LICENSE"
|
39
|
+
}
|
40
|
+
],
|
41
|
+
"_id": "hoek@0.9.1",
|
42
|
+
"dist": {
|
43
|
+
"shasum": "3d322462badf07716ea7eb85baf88079cddce505",
|
44
|
+
"tarball": "http://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz"
|
45
|
+
},
|
46
|
+
"_from": "hoek@>=0.9.0 <0.10.0",
|
47
|
+
"_npmVersion": "1.2.18",
|
48
|
+
"_npmUser": {
|
49
|
+
"name": "hueniverse",
|
50
|
+
"email": "eran@hueniverse.com"
|
51
|
+
},
|
52
|
+
"maintainers": [
|
53
|
+
{
|
54
|
+
"name": "hueniverse",
|
55
|
+
"email": "eran@hueniverse.com"
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"name": "thegoleffect",
|
59
|
+
"email": "thegoleffect@gmail.com"
|
60
|
+
}
|
61
|
+
],
|
62
|
+
"directories": {},
|
63
|
+
"_shasum": "3d322462badf07716ea7eb85baf88079cddce505",
|
64
|
+
"_resolved": "https://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz",
|
65
|
+
"bugs": {
|
66
|
+
"url": "https://github.com/spumko/hoek/issues"
|
67
|
+
},
|
68
|
+
"readme": "ERROR: No README data found!",
|
69
|
+
"homepage": "https://github.com/spumko/hoek#readme"
|
70
|
+
}
|
@@ -0,0 +1,86 @@
|
|
1
|
+
// Load modules
|
2
|
+
|
3
|
+
var Lab = require('lab');
|
4
|
+
var Hoek = require('../lib');
|
5
|
+
|
6
|
+
|
7
|
+
// Declare internals
|
8
|
+
|
9
|
+
var internals = {};
|
10
|
+
|
11
|
+
|
12
|
+
// Test shortcuts
|
13
|
+
|
14
|
+
var expect = Lab.expect;
|
15
|
+
var before = Lab.before;
|
16
|
+
var after = Lab.after;
|
17
|
+
var describe = Lab.experiment;
|
18
|
+
var it = Lab.test;
|
19
|
+
|
20
|
+
|
21
|
+
describe('Hoek', function () {
|
22
|
+
|
23
|
+
describe('#escapeJavaScript', function () {
|
24
|
+
|
25
|
+
it('encodes / characters', function (done) {
|
26
|
+
|
27
|
+
var encoded = Hoek.escapeJavaScript('<script>alert(1)</script>');
|
28
|
+
expect(encoded).to.equal('\\x3cscript\\x3ealert\\x281\\x29\\x3c\\x2fscript\\x3e');
|
29
|
+
done();
|
30
|
+
});
|
31
|
+
|
32
|
+
it('encodes \' characters', function (done) {
|
33
|
+
|
34
|
+
var encoded = Hoek.escapeJavaScript('something(\'param\')');
|
35
|
+
expect(encoded).to.equal('something\\x28\\x27param\\x27\\x29');
|
36
|
+
done();
|
37
|
+
});
|
38
|
+
|
39
|
+
it('encodes large unicode characters with the correct padding', function (done) {
|
40
|
+
|
41
|
+
var encoded = Hoek.escapeJavaScript(String.fromCharCode(500) + String.fromCharCode(1000));
|
42
|
+
expect(encoded).to.equal('\\u0500\\u1000');
|
43
|
+
done();
|
44
|
+
});
|
45
|
+
|
46
|
+
it('doesn\'t throw an exception when passed null', function (done) {
|
47
|
+
|
48
|
+
var encoded = Hoek.escapeJavaScript(null);
|
49
|
+
expect(encoded).to.equal('');
|
50
|
+
done();
|
51
|
+
});
|
52
|
+
});
|
53
|
+
|
54
|
+
describe('#escapeHtml', function () {
|
55
|
+
|
56
|
+
it('encodes / characters', function (done) {
|
57
|
+
|
58
|
+
var encoded = Hoek.escapeHtml('<script>alert(1)</script>');
|
59
|
+
expect(encoded).to.equal('<script>alert(1)</script>');
|
60
|
+
done();
|
61
|
+
});
|
62
|
+
|
63
|
+
it('encodes < and > as named characters', function (done) {
|
64
|
+
|
65
|
+
var encoded = Hoek.escapeHtml('<script><>');
|
66
|
+
expect(encoded).to.equal('<script><>');
|
67
|
+
done();
|
68
|
+
});
|
69
|
+
|
70
|
+
it('encodes large unicode characters', function (done) {
|
71
|
+
|
72
|
+
var encoded = Hoek.escapeHtml(String.fromCharCode(500) + String.fromCharCode(1000));
|
73
|
+
expect(encoded).to.equal('ǴϨ');
|
74
|
+
done();
|
75
|
+
});
|
76
|
+
|
77
|
+
it('doesn\'t throw an exception when passed null', function (done) {
|
78
|
+
|
79
|
+
var encoded = Hoek.escapeHtml(null);
|
80
|
+
expect(encoded).to.equal('');
|
81
|
+
done();
|
82
|
+
});
|
83
|
+
});
|
84
|
+
});
|
85
|
+
|
86
|
+
|
@@ -0,0 +1,1078 @@
|
|
1
|
+
// Load modules
|
2
|
+
|
3
|
+
var Lab = require('lab');
|
4
|
+
var Hoek = require('../lib');
|
5
|
+
|
6
|
+
|
7
|
+
// Declare internals
|
8
|
+
|
9
|
+
var internals = {};
|
10
|
+
|
11
|
+
|
12
|
+
// Test shortcuts
|
13
|
+
|
14
|
+
var expect = Lab.expect;
|
15
|
+
var before = Lab.before;
|
16
|
+
var after = Lab.after;
|
17
|
+
var describe = Lab.experiment;
|
18
|
+
var it = Lab.test;
|
19
|
+
|
20
|
+
|
21
|
+
describe('Hoek', function () {
|
22
|
+
|
23
|
+
var nestedObj = {
|
24
|
+
v: [7,8,9],
|
25
|
+
w: /^something$/igm,
|
26
|
+
x: {
|
27
|
+
a: [1, 2, 3],
|
28
|
+
b: 123456,
|
29
|
+
c: new Date(),
|
30
|
+
d: /hi/igm,
|
31
|
+
e: /hello/
|
32
|
+
},
|
33
|
+
y: 'y',
|
34
|
+
z: new Date()
|
35
|
+
};
|
36
|
+
|
37
|
+
var dupsArray = [nestedObj, { z: 'z' }, nestedObj];
|
38
|
+
var reducedDupsArray = [nestedObj, { z: 'z' }];
|
39
|
+
|
40
|
+
describe('#clone', function () {
|
41
|
+
|
42
|
+
it('should clone a nested object', function (done) {
|
43
|
+
|
44
|
+
var a = nestedObj;
|
45
|
+
var b = Hoek.clone(a);
|
46
|
+
|
47
|
+
expect(a).to.deep.equal(b);
|
48
|
+
expect(a.z.getTime()).to.equal(b.z.getTime());
|
49
|
+
done();
|
50
|
+
});
|
51
|
+
|
52
|
+
it('should clone a null object', function (done) {
|
53
|
+
|
54
|
+
var b = Hoek.clone(null);
|
55
|
+
|
56
|
+
expect(b).to.equal(null);
|
57
|
+
done();
|
58
|
+
});
|
59
|
+
|
60
|
+
it('should not convert undefined properties to null', function (done) {
|
61
|
+
|
62
|
+
var obj = { something: undefined };
|
63
|
+
var b = Hoek.clone(obj);
|
64
|
+
|
65
|
+
expect(typeof b.something).to.equal('undefined');
|
66
|
+
done();
|
67
|
+
});
|
68
|
+
|
69
|
+
it('should not throw on circular reference', function (done) {
|
70
|
+
|
71
|
+
var a = {};
|
72
|
+
a.x = a;
|
73
|
+
|
74
|
+
var test = (function () {
|
75
|
+
|
76
|
+
var b = Hoek.clone(a);
|
77
|
+
});
|
78
|
+
|
79
|
+
expect(test).to.not.throw();
|
80
|
+
done();
|
81
|
+
});
|
82
|
+
|
83
|
+
it('should properly clone circular reference', function (done) {
|
84
|
+
|
85
|
+
var x = {
|
86
|
+
'z': new Date()
|
87
|
+
};
|
88
|
+
x.y = x;
|
89
|
+
|
90
|
+
var b = Hoek.clone(x);
|
91
|
+
expect(Object.keys(b.y)).to.deep.equal(Object.keys(x))
|
92
|
+
expect(b.z).to.not.equal(x.z);
|
93
|
+
expect(b.y).to.not.equal(x.y);
|
94
|
+
expect(b.y.z).to.not.equal(x.y.z);
|
95
|
+
expect(b.y).to.equal(b);
|
96
|
+
expect(b.y.y.y.y).to.equal(b);
|
97
|
+
done();
|
98
|
+
});
|
99
|
+
|
100
|
+
it('should properly clone deeply nested object', function (done) {
|
101
|
+
|
102
|
+
var a = {
|
103
|
+
x: {
|
104
|
+
y: {
|
105
|
+
a: [1, 2, 3],
|
106
|
+
b: 123456,
|
107
|
+
c: new Date(),
|
108
|
+
d: /hi/igm,
|
109
|
+
e: /hello/
|
110
|
+
},
|
111
|
+
}
|
112
|
+
};
|
113
|
+
|
114
|
+
var b = Hoek.clone(a);
|
115
|
+
|
116
|
+
expect(a).to.deep.equal(b);
|
117
|
+
expect(a.x.y.c.getTime()).to.equal(b.x.y.c.getTime());
|
118
|
+
done();
|
119
|
+
});
|
120
|
+
|
121
|
+
it('should properly clone arrays', function (done) {
|
122
|
+
|
123
|
+
var a = [1,2,3];
|
124
|
+
|
125
|
+
var b = Hoek.clone(a);
|
126
|
+
|
127
|
+
expect(a).to.deep.equal(b);
|
128
|
+
done();
|
129
|
+
});
|
130
|
+
|
131
|
+
it('should perform actual copy for shallow keys (no pass by reference)', function (done) {
|
132
|
+
|
133
|
+
var x = Hoek.clone(nestedObj);
|
134
|
+
var y = Hoek.clone(nestedObj);
|
135
|
+
|
136
|
+
// Date
|
137
|
+
expect(x.z).to.not.equal(nestedObj.z);
|
138
|
+
expect(x.z).to.not.equal(y.z);
|
139
|
+
|
140
|
+
// Regex
|
141
|
+
expect(x.w).to.not.equal(nestedObj.w);
|
142
|
+
expect(x.w).to.not.equal(y.w);
|
143
|
+
|
144
|
+
// Array
|
145
|
+
expect(x.v).to.not.equal(nestedObj.v);
|
146
|
+
expect(x.v).to.not.equal(y.v);
|
147
|
+
|
148
|
+
// Immutable(s)
|
149
|
+
x.y = 5;
|
150
|
+
expect(x.y).to.not.equal(nestedObj.y);
|
151
|
+
expect(x.y).to.not.equal(y.y);
|
152
|
+
|
153
|
+
done();
|
154
|
+
});
|
155
|
+
|
156
|
+
it('should perform actual copy for deep keys (no pass by reference)', function (done) {
|
157
|
+
|
158
|
+
var x = Hoek.clone(nestedObj);
|
159
|
+
var y = Hoek.clone(nestedObj);
|
160
|
+
|
161
|
+
expect(x.x.c).to.not.equal(nestedObj.x.c);
|
162
|
+
expect(x.x.c).to.not.equal(y.x.c);
|
163
|
+
|
164
|
+
expect(x.x.c.getTime()).to.equal(nestedObj.x.c.getTime());
|
165
|
+
expect(x.x.c.getTime()).to.equal(y.x.c.getTime());
|
166
|
+
done();
|
167
|
+
});
|
168
|
+
|
169
|
+
it('copies functions with properties', function (done) {
|
170
|
+
|
171
|
+
var a = {
|
172
|
+
x: function () { return 1; },
|
173
|
+
y: {}
|
174
|
+
};
|
175
|
+
a.x.z = 'string in function';
|
176
|
+
a.x.v = function () { return 2; };
|
177
|
+
a.y.u = a.x;
|
178
|
+
|
179
|
+
var b = Hoek.clone(a);
|
180
|
+
expect(b.x()).to.equal(1);
|
181
|
+
expect(b.x.v()).to.equal(2);
|
182
|
+
expect(b.y.u).to.equal(b.x);
|
183
|
+
expect(b.x.z).to.equal('string in function');
|
184
|
+
done();
|
185
|
+
});
|
186
|
+
|
187
|
+
it('should copy a buffer', function(done){
|
188
|
+
var tls = {
|
189
|
+
key: new Buffer([1,2,3,4,5]),
|
190
|
+
cert: new Buffer([1,2,3,4,5,6,10])
|
191
|
+
}
|
192
|
+
|
193
|
+
copiedTls = Hoek.clone(tls);
|
194
|
+
expect(Buffer.isBuffer(copiedTls.key)).to.equal(true);
|
195
|
+
expect(JSON.stringify(copiedTls.key)).to.equal(JSON.stringify(tls.key))
|
196
|
+
expect(Buffer.isBuffer(copiedTls.cert)).to.equal(true);
|
197
|
+
expect(JSON.stringify(copiedTls.cert)).to.equal(JSON.stringify(tls.cert))
|
198
|
+
done();
|
199
|
+
});
|
200
|
+
});
|
201
|
+
|
202
|
+
describe('#merge', function () {
|
203
|
+
|
204
|
+
it('does not throw if source is null', function (done) {
|
205
|
+
|
206
|
+
var a = {};
|
207
|
+
var b = null;
|
208
|
+
var c = null;
|
209
|
+
|
210
|
+
expect(function () {
|
211
|
+
|
212
|
+
c = Hoek.merge(a, b);
|
213
|
+
}).to.not.throw();
|
214
|
+
|
215
|
+
expect(c).to.equal(a);
|
216
|
+
done();
|
217
|
+
});
|
218
|
+
|
219
|
+
it('does not throw if source is undefined', function (done) {
|
220
|
+
|
221
|
+
var a = {};
|
222
|
+
var b = undefined;
|
223
|
+
var c = null;
|
224
|
+
|
225
|
+
expect(function () {
|
226
|
+
|
227
|
+
c = Hoek.merge(a, b);
|
228
|
+
}).to.not.throw();
|
229
|
+
|
230
|
+
expect(c).to.equal(a);
|
231
|
+
done();
|
232
|
+
});
|
233
|
+
|
234
|
+
it('throws if source is not an object', function (done) {
|
235
|
+
|
236
|
+
expect(function () {
|
237
|
+
|
238
|
+
var a = {};
|
239
|
+
var b = 0;
|
240
|
+
|
241
|
+
Hoek.merge(a, b);
|
242
|
+
}).to.throw('Invalid source value: must be null, undefined, or an object');
|
243
|
+
done();
|
244
|
+
});
|
245
|
+
|
246
|
+
it('throws if target is not an object', function (done) {
|
247
|
+
|
248
|
+
expect(function () {
|
249
|
+
|
250
|
+
var a = 0;
|
251
|
+
var b = {};
|
252
|
+
|
253
|
+
Hoek.merge(a, b);
|
254
|
+
}).to.throw('Invalid target value: must be an object');
|
255
|
+
done();
|
256
|
+
});
|
257
|
+
|
258
|
+
it('throws if target is not an array and source is', function (done) {
|
259
|
+
|
260
|
+
expect(function () {
|
261
|
+
|
262
|
+
var a = {};
|
263
|
+
var b = [1, 2];
|
264
|
+
|
265
|
+
Hoek.merge(a, b);
|
266
|
+
}).to.throw('Cannot merge array onto an object');
|
267
|
+
done();
|
268
|
+
});
|
269
|
+
|
270
|
+
it('returns the same object when merging arrays', function (done) {
|
271
|
+
|
272
|
+
var a = [];
|
273
|
+
var b = [1, 2];
|
274
|
+
|
275
|
+
expect(Hoek.merge(a, b)).to.equal(a);
|
276
|
+
done();
|
277
|
+
});
|
278
|
+
|
279
|
+
it('should combine an empty object with a non-empty object', function (done) {
|
280
|
+
|
281
|
+
var a = {};
|
282
|
+
var b = nestedObj;
|
283
|
+
|
284
|
+
var c = Hoek.merge(a, b);
|
285
|
+
expect(a).to.deep.equal(b);
|
286
|
+
expect(c).to.deep.equal(b);
|
287
|
+
done();
|
288
|
+
});
|
289
|
+
|
290
|
+
it('should override values in target', function (done) {
|
291
|
+
|
292
|
+
var a = { x: 1, y: 2, z: 3, v: 5, t: 'test', m: 'abc' };
|
293
|
+
var b = { x: null, z: 4, v: 0, t: { u: 6 }, m: '123' };
|
294
|
+
|
295
|
+
var c = Hoek.merge(a, b);
|
296
|
+
expect(c.x).to.equal(null);
|
297
|
+
expect(c.y).to.equal(2);
|
298
|
+
expect(c.z).to.equal(4);
|
299
|
+
expect(c.v).to.equal(0);
|
300
|
+
expect(c.m).to.equal('123');
|
301
|
+
expect(c.t).to.deep.equal({ u: 6 });
|
302
|
+
done();
|
303
|
+
});
|
304
|
+
|
305
|
+
it('should override values in target (flip)', function (done) {
|
306
|
+
|
307
|
+
var a = { x: 1, y: 2, z: 3, v: 5, t: 'test', m: 'abc' };
|
308
|
+
var b = { x: null, z: 4, v: 0, t: { u: 6 }, m: '123' };
|
309
|
+
|
310
|
+
var d = Hoek.merge(b, a);
|
311
|
+
expect(d.x).to.equal(1);
|
312
|
+
expect(d.y).to.equal(2);
|
313
|
+
expect(d.z).to.equal(3);
|
314
|
+
expect(d.v).to.equal(5);
|
315
|
+
expect(d.m).to.equal('abc');
|
316
|
+
expect(d.t).to.deep.equal('test');
|
317
|
+
done();
|
318
|
+
});
|
319
|
+
});
|
320
|
+
|
321
|
+
describe('#applyToDefaults', function () {
|
322
|
+
|
323
|
+
var defaults = {
|
324
|
+
a: 1,
|
325
|
+
b: 2,
|
326
|
+
c: {
|
327
|
+
d: 3,
|
328
|
+
e: [5, 6]
|
329
|
+
},
|
330
|
+
f: 6,
|
331
|
+
g: 'test'
|
332
|
+
};
|
333
|
+
|
334
|
+
it('should return null if options is false', function (done) {
|
335
|
+
|
336
|
+
var result = Hoek.applyToDefaults(defaults, false);
|
337
|
+
expect(result).to.equal(null);
|
338
|
+
done();
|
339
|
+
});
|
340
|
+
|
341
|
+
it('should return a copy of defaults if options is true', function (done) {
|
342
|
+
|
343
|
+
var result = Hoek.applyToDefaults(defaults, true);
|
344
|
+
expect(result).to.deep.equal(result);
|
345
|
+
done();
|
346
|
+
});
|
347
|
+
|
348
|
+
it('should apply object to defaults', function (done) {
|
349
|
+
|
350
|
+
var obj = {
|
351
|
+
a: null,
|
352
|
+
c: {
|
353
|
+
e: [4]
|
354
|
+
},
|
355
|
+
f: 0,
|
356
|
+
g: {
|
357
|
+
h: 5
|
358
|
+
}
|
359
|
+
};
|
360
|
+
|
361
|
+
var result = Hoek.applyToDefaults(defaults, obj);
|
362
|
+
expect(result.c.e).to.deep.equal([4]);
|
363
|
+
expect(result.a).to.equal(1);
|
364
|
+
expect(result.b).to.equal(2);
|
365
|
+
expect(result.f).to.equal(0);
|
366
|
+
expect(result.g).to.deep.equal({ h: 5 });
|
367
|
+
done();
|
368
|
+
});
|
369
|
+
});
|
370
|
+
|
371
|
+
describe('#unique', function () {
|
372
|
+
|
373
|
+
it('should ensure uniqueness within array of objects based on subkey', function (done) {
|
374
|
+
|
375
|
+
var a = Hoek.unique(dupsArray, 'x');
|
376
|
+
expect(a).to.deep.equal(reducedDupsArray);
|
377
|
+
done();
|
378
|
+
});
|
379
|
+
|
380
|
+
it('removes duplicated without key', function (done) {
|
381
|
+
|
382
|
+
expect(Hoek.unique([1, 2, 3, 4, 2, 1, 5])).to.deep.equal([1, 2, 3, 4, 5]);
|
383
|
+
done();
|
384
|
+
});
|
385
|
+
});
|
386
|
+
|
387
|
+
describe('#mapToObject', function () {
|
388
|
+
|
389
|
+
it('should return null on null array', function (done) {
|
390
|
+
|
391
|
+
var a = Hoek.mapToObject(null);
|
392
|
+
expect(a).to.equal(null);
|
393
|
+
done();
|
394
|
+
});
|
395
|
+
|
396
|
+
it('should convert basic array to existential object', function (done) {
|
397
|
+
|
398
|
+
var keys = [1, 2, 3, 4];
|
399
|
+
var a = Hoek.mapToObject(keys);
|
400
|
+
for (var i in keys) {
|
401
|
+
expect(a[keys[i]]).to.equal(true);
|
402
|
+
}
|
403
|
+
done();
|
404
|
+
});
|
405
|
+
|
406
|
+
it('should convert array of objects to existential object', function (done) {
|
407
|
+
|
408
|
+
var keys = [{ x: 1 }, { x: 2 }, { x: 3 }];
|
409
|
+
var subkey = 'x';
|
410
|
+
var a = Hoek.mapToObject(keys, subkey);
|
411
|
+
for (var i in keys) {
|
412
|
+
expect(a[keys[i][subkey]]).to.equal(true);
|
413
|
+
}
|
414
|
+
done();
|
415
|
+
});
|
416
|
+
});
|
417
|
+
|
418
|
+
describe('#intersect', function () {
|
419
|
+
|
420
|
+
it('should return the common objects of two arrays', function (done) {
|
421
|
+
|
422
|
+
var array1 = [1, 2, 3, 4, 4, 5, 5];
|
423
|
+
var array2 = [5, 4, 5, 6, 7];
|
424
|
+
var common = Hoek.intersect(array1, array2);
|
425
|
+
expect(common.length).to.equal(2);
|
426
|
+
done();
|
427
|
+
});
|
428
|
+
|
429
|
+
it('should return just the first common object of two arrays', function (done) {
|
430
|
+
|
431
|
+
var array1 = [1, 2, 3, 4, 4, 5, 5];
|
432
|
+
var array2 = [5, 4, 5, 6, 7];
|
433
|
+
var common = Hoek.intersect(array1, array2, true);
|
434
|
+
expect(common).to.equal(5);
|
435
|
+
done();
|
436
|
+
});
|
437
|
+
|
438
|
+
it('should return an empty array if either input is null', function (done) {
|
439
|
+
|
440
|
+
expect(Hoek.intersect([1], null).length).to.equal(0);
|
441
|
+
expect(Hoek.intersect(null, [1]).length).to.equal(0);
|
442
|
+
done();
|
443
|
+
});
|
444
|
+
|
445
|
+
it('should return the common objects of object and array', function (done) {
|
446
|
+
|
447
|
+
var array1 = [1, 2, 3, 4, 4, 5, 5];
|
448
|
+
var array2 = [5, 4, 5, 6, 7];
|
449
|
+
var common = Hoek.intersect(Hoek.mapToObject(array1), array2);
|
450
|
+
expect(common.length).to.equal(2);
|
451
|
+
done();
|
452
|
+
});
|
453
|
+
});
|
454
|
+
|
455
|
+
describe('#matchKeys', function () {
|
456
|
+
|
457
|
+
it('should match the existing object keys', function (done) {
|
458
|
+
|
459
|
+
var obj = {
|
460
|
+
a: 1,
|
461
|
+
b: 2,
|
462
|
+
c: 3,
|
463
|
+
d: null
|
464
|
+
};
|
465
|
+
|
466
|
+
expect(Hoek.matchKeys(obj, ['b', 'c', 'd', 'e'])).to.deep.equal(['b', 'c', 'd']);
|
467
|
+
done();
|
468
|
+
});
|
469
|
+
});
|
470
|
+
|
471
|
+
describe('#flatten', function () {
|
472
|
+
|
473
|
+
it('should return a flat array', function (done) {
|
474
|
+
|
475
|
+
var result = Hoek.flatten([1, 2, [3, 4, [5, 6], [7], 8], [9], [10, [11, 12]], 13]);
|
476
|
+
expect(result.length).to.equal(13);
|
477
|
+
expect(result).to.deep.equal([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]);
|
478
|
+
done();
|
479
|
+
});
|
480
|
+
});
|
481
|
+
|
482
|
+
describe('#removeKeys', function () {
|
483
|
+
|
484
|
+
var objWithHiddenKeys = {
|
485
|
+
location: {
|
486
|
+
name: 'San Bruno'
|
487
|
+
},
|
488
|
+
company: {
|
489
|
+
name: '@WalmartLabs'
|
490
|
+
}
|
491
|
+
};
|
492
|
+
|
493
|
+
it('should delete params with definition\'s hide set to true', function (done) {
|
494
|
+
|
495
|
+
var a = Hoek.removeKeys(objWithHiddenKeys, ['location']);
|
496
|
+
expect(objWithHiddenKeys.location).to.not.exist;
|
497
|
+
expect(objWithHiddenKeys.company).to.exist;
|
498
|
+
done();
|
499
|
+
});
|
500
|
+
});
|
501
|
+
|
502
|
+
describe('#reach', function () {
|
503
|
+
|
504
|
+
var obj = {
|
505
|
+
a: {
|
506
|
+
b: {
|
507
|
+
c: {
|
508
|
+
d: 1,
|
509
|
+
e: 2
|
510
|
+
},
|
511
|
+
f: 'hello'
|
512
|
+
},
|
513
|
+
g: {
|
514
|
+
h: 3
|
515
|
+
}
|
516
|
+
},
|
517
|
+
i: function () { }
|
518
|
+
};
|
519
|
+
|
520
|
+
it('returns a valid member', function (done) {
|
521
|
+
|
522
|
+
expect(Hoek.reach(obj, 'a.b.c.d')).to.equal(1);
|
523
|
+
done();
|
524
|
+
});
|
525
|
+
|
526
|
+
it('returns null on null object', function (done) {
|
527
|
+
|
528
|
+
expect(Hoek.reach(null, 'a.b.c.d')).to.not.exist;
|
529
|
+
done();
|
530
|
+
});
|
531
|
+
|
532
|
+
it('returns null on missing member', function (done) {
|
533
|
+
|
534
|
+
expect(Hoek.reach(obj, 'a.b.c.d.x')).to.not.exist;
|
535
|
+
done();
|
536
|
+
});
|
537
|
+
|
538
|
+
it('returns null on invalid member', function (done) {
|
539
|
+
|
540
|
+
expect(Hoek.reach(obj, 'a.b.c.d-.x')).to.not.exist;
|
541
|
+
done();
|
542
|
+
});
|
543
|
+
|
544
|
+
it('returns function member', function (done) {
|
545
|
+
|
546
|
+
expect(typeof Hoek.reach(obj, 'i')).to.equal('function');
|
547
|
+
done();
|
548
|
+
});
|
549
|
+
});
|
550
|
+
|
551
|
+
describe('#inheritAsync', function () {
|
552
|
+
|
553
|
+
it('should inherit selected methods and wrap in async call', function (done) {
|
554
|
+
|
555
|
+
var proto = {
|
556
|
+
a: function () {
|
557
|
+
return 'a!';
|
558
|
+
},
|
559
|
+
b: function () {
|
560
|
+
return 'b!';
|
561
|
+
},
|
562
|
+
c: function () {
|
563
|
+
throw new Error('c!');
|
564
|
+
}
|
565
|
+
};
|
566
|
+
|
567
|
+
var targetFunc = function () { };
|
568
|
+
targetFunc.prototype.c = function () {
|
569
|
+
|
570
|
+
return 'oops';
|
571
|
+
};
|
572
|
+
|
573
|
+
Hoek.inheritAsync(targetFunc, proto, ['a', 'c']);
|
574
|
+
var target = new targetFunc();
|
575
|
+
|
576
|
+
expect(typeof target.a).to.equal('function');
|
577
|
+
expect(typeof target.c).to.equal('function');
|
578
|
+
expect(target.b).to.not.exist;
|
579
|
+
|
580
|
+
target.a(function (err, result) {
|
581
|
+
|
582
|
+
expect(err).to.not.exist;
|
583
|
+
expect(result).to.equal('a!');
|
584
|
+
|
585
|
+
target.c(function (err, result) {
|
586
|
+
|
587
|
+
expect(result).to.not.exist;
|
588
|
+
expect(err.message).to.equal('c!');
|
589
|
+
done();
|
590
|
+
});
|
591
|
+
});
|
592
|
+
});
|
593
|
+
});
|
594
|
+
|
595
|
+
describe('#callStack', function () {
|
596
|
+
|
597
|
+
it('should return the full call stack', function (done) {
|
598
|
+
|
599
|
+
var stack = Hoek.callStack();
|
600
|
+
expect(stack[0][0]).to.contain('index.js');
|
601
|
+
expect(stack[0][2]).to.equal(30);
|
602
|
+
done();
|
603
|
+
});
|
604
|
+
});
|
605
|
+
|
606
|
+
describe('#displayStack ', function () {
|
607
|
+
|
608
|
+
it('should return the full call stack for display', function (done) {
|
609
|
+
|
610
|
+
var stack = Hoek.displayStack();
|
611
|
+
expect(stack[0]).to.contain('test/index.js:');
|
612
|
+
done();
|
613
|
+
});
|
614
|
+
|
615
|
+
it('should include constructor functions correctly', function (done) {
|
616
|
+
|
617
|
+
var Something = function (next) {
|
618
|
+
|
619
|
+
next();
|
620
|
+
};
|
621
|
+
|
622
|
+
var something = new Something(function () {
|
623
|
+
|
624
|
+
var stack = Hoek.displayStack();
|
625
|
+
expect(stack[1]).to.contain('new Something');
|
626
|
+
done();
|
627
|
+
});
|
628
|
+
});
|
629
|
+
});
|
630
|
+
|
631
|
+
describe('#abort', function () {
|
632
|
+
|
633
|
+
it('should exit process when not in test mode', function (done) {
|
634
|
+
|
635
|
+
var env = process.env.NODE_ENV;
|
636
|
+
var write = process.stdout.write;
|
637
|
+
var exit = process.exit;
|
638
|
+
|
639
|
+
process.env.NODE_ENV = 'nottatest';
|
640
|
+
process.stdout.write = function () { };
|
641
|
+
process.exit = function (state) {
|
642
|
+
|
643
|
+
process.exit = exit;
|
644
|
+
process.env.NODE_ENV = env;
|
645
|
+
process.stdout.write = write;
|
646
|
+
|
647
|
+
expect(state).to.equal(1);
|
648
|
+
done();
|
649
|
+
};
|
650
|
+
|
651
|
+
Hoek.abort('Boom');
|
652
|
+
});
|
653
|
+
|
654
|
+
it('should throw when not in test mode and abortThrow is true', function (done) {
|
655
|
+
|
656
|
+
var env = process.env.NODE_ENV;
|
657
|
+
process.env.NODE_ENV = 'nottatest';
|
658
|
+
Hoek.abortThrow = true;
|
659
|
+
|
660
|
+
var fn = function () {
|
661
|
+
|
662
|
+
Hoek.abort('my error message');
|
663
|
+
};
|
664
|
+
|
665
|
+
expect(fn).to.throw('my error message');
|
666
|
+
Hoek.abortThrow = false;
|
667
|
+
process.env.NODE_ENV = env;
|
668
|
+
|
669
|
+
done();
|
670
|
+
});
|
671
|
+
|
672
|
+
|
673
|
+
it('should respect hideStack argument', function (done) {
|
674
|
+
|
675
|
+
var env = process.env.NODE_ENV;
|
676
|
+
var write = process.stdout.write;
|
677
|
+
var exit = process.exit;
|
678
|
+
var output = '';
|
679
|
+
|
680
|
+
process.exit = function () { };
|
681
|
+
process.env.NODE_ENV = '';
|
682
|
+
process.stdout.write = function (message) {
|
683
|
+
|
684
|
+
output = message;
|
685
|
+
};
|
686
|
+
|
687
|
+
Hoek.abort('my error message', true);
|
688
|
+
|
689
|
+
process.env.NODE_ENV = env;
|
690
|
+
process.stdout.write = write;
|
691
|
+
process.exit = exit;
|
692
|
+
|
693
|
+
expect(output).to.equal('ABORT: my error message\n\t\n');
|
694
|
+
|
695
|
+
done();
|
696
|
+
});
|
697
|
+
|
698
|
+
it('should default to showing stack', function (done) {
|
699
|
+
|
700
|
+
var env = process.env.NODE_ENV;
|
701
|
+
var write = process.stdout.write;
|
702
|
+
var exit = process.exit;
|
703
|
+
var output = '';
|
704
|
+
|
705
|
+
process.exit = function () { };
|
706
|
+
process.env.NODE_ENV = '';
|
707
|
+
process.stdout.write = function (message) {
|
708
|
+
|
709
|
+
output = message;
|
710
|
+
};
|
711
|
+
|
712
|
+
Hoek.abort('my error message');
|
713
|
+
|
714
|
+
process.env.NODE_ENV = env;
|
715
|
+
process.stdout.write = write;
|
716
|
+
process.exit = exit;
|
717
|
+
|
718
|
+
expect(output).to.contain('index.js');
|
719
|
+
|
720
|
+
done();
|
721
|
+
});
|
722
|
+
});
|
723
|
+
|
724
|
+
describe('#assert', function () {
|
725
|
+
|
726
|
+
it('should throw an Error when using assert in a test', function (done) {
|
727
|
+
|
728
|
+
var fn = function () {
|
729
|
+
|
730
|
+
Hoek.assert(false, 'my error message');
|
731
|
+
};
|
732
|
+
|
733
|
+
expect(fn).to.throw('my error message');
|
734
|
+
done();
|
735
|
+
});
|
736
|
+
|
737
|
+
it('should throw an Error when using assert in a test with no message', function (done) {
|
738
|
+
|
739
|
+
var fn = function () {
|
740
|
+
|
741
|
+
Hoek.assert(false);
|
742
|
+
};
|
743
|
+
|
744
|
+
expect(fn).to.throw('Unknown error');
|
745
|
+
done();
|
746
|
+
});
|
747
|
+
|
748
|
+
it('should throw an Error when using assert in a test with multipart message', function (done) {
|
749
|
+
|
750
|
+
var fn = function () {
|
751
|
+
|
752
|
+
Hoek.assert(false, 'This', 'is', 'my message');
|
753
|
+
};
|
754
|
+
|
755
|
+
expect(fn).to.throw('This is my message');
|
756
|
+
done();
|
757
|
+
});
|
758
|
+
|
759
|
+
it('should throw an Error when using assert in a test with object message', function (done) {
|
760
|
+
|
761
|
+
var fn = function () {
|
762
|
+
|
763
|
+
Hoek.assert(false, 'This', 'is', { spinal: 'tap' });
|
764
|
+
};
|
765
|
+
|
766
|
+
expect(fn).to.throw('This is {"spinal":"tap"}');
|
767
|
+
done();
|
768
|
+
});
|
769
|
+
|
770
|
+
it('should throw an Error when using assert in a test with error object message', function (done) {
|
771
|
+
|
772
|
+
var fn = function () {
|
773
|
+
|
774
|
+
Hoek.assert(false, new Error('This is spinal tap'));
|
775
|
+
};
|
776
|
+
|
777
|
+
expect(fn).to.throw('This is spinal tap');
|
778
|
+
done();
|
779
|
+
});
|
780
|
+
});
|
781
|
+
|
782
|
+
describe('#loadDirModules', function () {
|
783
|
+
|
784
|
+
it('should load modules from directory', function (done) {
|
785
|
+
|
786
|
+
var target = {};
|
787
|
+
Hoek.loadDirModules(__dirname + '/modules', ['test2'], target);
|
788
|
+
expect(target.Test1.x).to.equal(1);
|
789
|
+
expect(target.Test2).to.not.exist;
|
790
|
+
expect(target.Test3.z).to.equal(3);
|
791
|
+
done();
|
792
|
+
});
|
793
|
+
|
794
|
+
it('should list modules from directory into function', function (done) {
|
795
|
+
|
796
|
+
var target = {};
|
797
|
+
Hoek.loadDirModules(__dirname + '/modules', ['test2'], function (path, name, capName) {
|
798
|
+
|
799
|
+
target[name] = capName;
|
800
|
+
});
|
801
|
+
|
802
|
+
expect(target.test1).to.equal('Test1');
|
803
|
+
expect(target.test2).to.not.exist;
|
804
|
+
expect(target.test3).to.equal('Test3');
|
805
|
+
done();
|
806
|
+
});
|
807
|
+
});
|
808
|
+
|
809
|
+
describe('#rename', function () {
|
810
|
+
|
811
|
+
it('should rename object key', function (done) {
|
812
|
+
|
813
|
+
var a = { b: 'c' };
|
814
|
+
Hoek.rename(a, 'b', 'x');
|
815
|
+
expect(a.b).to.not.exist;
|
816
|
+
expect(a.x).to.equal('c');
|
817
|
+
done();
|
818
|
+
});
|
819
|
+
});
|
820
|
+
|
821
|
+
describe('Timer', function () {
|
822
|
+
|
823
|
+
it('should return time elapsed', function (done) {
|
824
|
+
|
825
|
+
var timer = new Hoek.Timer();
|
826
|
+
setTimeout(function () {
|
827
|
+
|
828
|
+
expect(timer.elapsed()).to.be.above(9);
|
829
|
+
done();
|
830
|
+
}, 12);
|
831
|
+
});
|
832
|
+
});
|
833
|
+
|
834
|
+
describe('#loadPackage', function () {
|
835
|
+
|
836
|
+
it('should', function (done) {
|
837
|
+
|
838
|
+
var pack = Hoek.loadPackage();
|
839
|
+
expect(pack.name).to.equal('hoek');
|
840
|
+
done();
|
841
|
+
});
|
842
|
+
});
|
843
|
+
|
844
|
+
describe('#escapeRegex', function () {
|
845
|
+
|
846
|
+
it('should escape all special regular expression characters', function (done) {
|
847
|
+
|
848
|
+
var a = Hoek.escapeRegex('4^f$s.4*5+-_?%=#!:@|~\\/`"(>)[<]d{}s,');
|
849
|
+
expect(a).to.equal('4\\^f\\$s\\.4\\*5\\+\\-_\\?%\\=#\\!\\:@\\|~\\\\\\/`"\\(>\\)\\[<\\]d\\{\\}s\\,');
|
850
|
+
done();
|
851
|
+
});
|
852
|
+
});
|
853
|
+
|
854
|
+
describe('#toss', function () {
|
855
|
+
|
856
|
+
it('should call callback with new error', function (done) {
|
857
|
+
|
858
|
+
var callback = function (err) {
|
859
|
+
|
860
|
+
expect(err).to.exist;
|
861
|
+
expect(err.message).to.equal('bug');
|
862
|
+
done();
|
863
|
+
};
|
864
|
+
|
865
|
+
Hoek.toss(true, 'feature', callback);
|
866
|
+
Hoek.toss(false, 'bug', callback);
|
867
|
+
});
|
868
|
+
|
869
|
+
it('should call callback with new error and no message', function (done) {
|
870
|
+
|
871
|
+
Hoek.toss(false, function (err) {
|
872
|
+
|
873
|
+
expect(err).to.exist;
|
874
|
+
expect(err.message).to.equal('');
|
875
|
+
done();
|
876
|
+
});
|
877
|
+
});
|
878
|
+
|
879
|
+
it('should call callback with error condition', function (done) {
|
880
|
+
|
881
|
+
Hoek.toss(new Error('boom'), function (err) {
|
882
|
+
|
883
|
+
expect(err).to.exist;
|
884
|
+
expect(err.message).to.equal('boom');
|
885
|
+
done();
|
886
|
+
});
|
887
|
+
});
|
888
|
+
|
889
|
+
it('should call callback with new error using message with error condition', function (done) {
|
890
|
+
|
891
|
+
Hoek.toss(new Error('ka'), 'boom', function (err) {
|
892
|
+
|
893
|
+
expect(err).to.exist;
|
894
|
+
expect(err.message).to.equal('boom');
|
895
|
+
done();
|
896
|
+
});
|
897
|
+
});
|
898
|
+
|
899
|
+
it('should call callback with new error using passed error with error condition', function (done) {
|
900
|
+
|
901
|
+
Hoek.toss(new Error('ka'), new Error('boom'), function (err) {
|
902
|
+
|
903
|
+
expect(err).to.exist;
|
904
|
+
expect(err.message).to.equal('boom');
|
905
|
+
done();
|
906
|
+
});
|
907
|
+
});
|
908
|
+
});
|
909
|
+
|
910
|
+
describe('Base64Url', function () {
|
911
|
+
|
912
|
+
var base64str = 'AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0-P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn-AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq-wsbKztLW2t7i5uru8vb6_wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t_g4eLj5OXm5-jp6uvs7e7v8PHy8_T19vf4-fr7_P3-_w';
|
913
|
+
var str = unescape('%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20%21%22%23%24%25%26%27%28%29*+%2C-./0123456789%3A%3B%3C%3D%3E%3F@ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E%7F%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF');
|
914
|
+
|
915
|
+
describe('#base64urlEncode', function () {
|
916
|
+
|
917
|
+
it('should base64 URL-safe a string', function (done) {
|
918
|
+
|
919
|
+
expect(Hoek.base64urlEncode(str)).to.equal(base64str);
|
920
|
+
done();
|
921
|
+
});
|
922
|
+
});
|
923
|
+
|
924
|
+
describe('#base64urlDecode', function () {
|
925
|
+
|
926
|
+
it('should un-base64 URL-safe a string', function (done) {
|
927
|
+
|
928
|
+
expect(Hoek.base64urlDecode(base64str)).to.equal(str);
|
929
|
+
done();
|
930
|
+
});
|
931
|
+
|
932
|
+
it('should return error on undefined input', function (done) {
|
933
|
+
|
934
|
+
expect(Hoek.base64urlDecode().message).to.exist;
|
935
|
+
done();
|
936
|
+
});
|
937
|
+
|
938
|
+
it('should return error on invalid input', function (done) {
|
939
|
+
|
940
|
+
expect(Hoek.base64urlDecode('*').message).to.exist;
|
941
|
+
done();
|
942
|
+
});
|
943
|
+
});
|
944
|
+
});
|
945
|
+
|
946
|
+
describe('#escapeHeaderAttribute', function () {
|
947
|
+
|
948
|
+
it('should not alter ascii values', function (done) {
|
949
|
+
|
950
|
+
var a = Hoek.escapeHeaderAttribute('My Value');
|
951
|
+
expect(a).to.equal('My Value');
|
952
|
+
done();
|
953
|
+
});
|
954
|
+
|
955
|
+
it('should escape all special HTTP header attribute characters', function (done) {
|
956
|
+
|
957
|
+
var a = Hoek.escapeHeaderAttribute('I said go!!!#"' + String.fromCharCode(92));
|
958
|
+
expect(a).to.equal('I said go!!!#\\"\\\\');
|
959
|
+
done();
|
960
|
+
});
|
961
|
+
|
962
|
+
it('should throw on large unicode characters', function (done) {
|
963
|
+
|
964
|
+
var fn = function () {
|
965
|
+
|
966
|
+
Hoek.escapeHeaderAttribute('this is a test' + String.fromCharCode(500) + String.fromCharCode(300));
|
967
|
+
};
|
968
|
+
|
969
|
+
expect(fn).to.throw(Error);
|
970
|
+
done();
|
971
|
+
});
|
972
|
+
|
973
|
+
it('should throw on CRLF to prevent response splitting', function (done) {
|
974
|
+
|
975
|
+
var fn = function () {
|
976
|
+
|
977
|
+
Hoek.escapeHeaderAttribute('this is a test\r\n');
|
978
|
+
};
|
979
|
+
|
980
|
+
expect(fn).to.throw(Error);
|
981
|
+
done();
|
982
|
+
});
|
983
|
+
});
|
984
|
+
|
985
|
+
describe('#escapeHtml', function () {
|
986
|
+
|
987
|
+
it('should escape all special HTML characters', function (done) {
|
988
|
+
|
989
|
+
var a = Hoek.escapeHtml('&<>"\'`');
|
990
|
+
expect(a).to.equal('&<>"'`');
|
991
|
+
done();
|
992
|
+
});
|
993
|
+
|
994
|
+
it('should return empty string on falsy input', function (done) {
|
995
|
+
|
996
|
+
var a = Hoek.escapeHtml('');
|
997
|
+
expect(a).to.equal('');
|
998
|
+
done();
|
999
|
+
});
|
1000
|
+
|
1001
|
+
it('should return unchanged string on no reserved input', function (done) {
|
1002
|
+
|
1003
|
+
var a = Hoek.escapeHtml('abc');
|
1004
|
+
expect(a).to.equal('abc');
|
1005
|
+
done();
|
1006
|
+
});
|
1007
|
+
});
|
1008
|
+
|
1009
|
+
describe('#printEvent', function () {
|
1010
|
+
|
1011
|
+
it('outputs event as string', function (done) {
|
1012
|
+
|
1013
|
+
var event = {
|
1014
|
+
timestamp: (new Date(2013, 1, 1, 6, 30, 45, 123)).getTime(),
|
1015
|
+
tags: ['a', 'b', 'c'],
|
1016
|
+
data: { some: 'data' }
|
1017
|
+
};
|
1018
|
+
|
1019
|
+
Hoek.consoleFunc = function (string) {
|
1020
|
+
|
1021
|
+
Hoek.consoleFunc = console.log;
|
1022
|
+
expect(string).to.equal('130201/063045.123, a, {"some":"data"}');
|
1023
|
+
done();
|
1024
|
+
};
|
1025
|
+
|
1026
|
+
Hoek.printEvent(event);
|
1027
|
+
});
|
1028
|
+
|
1029
|
+
it('outputs JSON error', function (done) {
|
1030
|
+
|
1031
|
+
var event = {
|
1032
|
+
timestamp: (new Date(2013, 1, 1, 6, 30, 45, 123)).getTime(),
|
1033
|
+
tags: ['a', 'b', 'c'],
|
1034
|
+
data: { some: 'data' }
|
1035
|
+
};
|
1036
|
+
|
1037
|
+
event.data.a = event.data;
|
1038
|
+
|
1039
|
+
Hoek.consoleFunc = function (string) {
|
1040
|
+
|
1041
|
+
Hoek.consoleFunc = console.log;
|
1042
|
+
expect(string).to.equal('130201/063045.123, a, JSON Error: Converting circular structure to JSON');
|
1043
|
+
done();
|
1044
|
+
};
|
1045
|
+
|
1046
|
+
Hoek.printEvent(event);
|
1047
|
+
});
|
1048
|
+
});
|
1049
|
+
|
1050
|
+
describe('#nextTick', function () {
|
1051
|
+
|
1052
|
+
it('calls the provided callback on nextTick', function (done) {
|
1053
|
+
|
1054
|
+
var a = 0;
|
1055
|
+
|
1056
|
+
var inc = function (step, next) {
|
1057
|
+
|
1058
|
+
a += step;
|
1059
|
+
next();
|
1060
|
+
};
|
1061
|
+
|
1062
|
+
var ticked = Hoek.nextTick(inc);
|
1063
|
+
|
1064
|
+
ticked(5, function () {
|
1065
|
+
|
1066
|
+
expect(a).to.equal(6);
|
1067
|
+
done();
|
1068
|
+
});
|
1069
|
+
|
1070
|
+
expect(a).to.equal(0);
|
1071
|
+
inc(1, function () {
|
1072
|
+
|
1073
|
+
expect(a).to.equal(1);
|
1074
|
+
});
|
1075
|
+
});
|
1076
|
+
});
|
1077
|
+
});
|
1078
|
+
|