We want to make contributing to tumblr.js
as easy and transparent as possible. If you run into
problems, please open an issue. We also actively welcome pull requests.
- Fork the repo and create your branch from
master
. - If you've added code that should be tested, add tests.
- If you've changed APIs, update the documentation.
- Ensure the test suite passes.
By contributing to tumblr.js you agree that your contributions will be licensed under its Apache 2.0 license.
First install dependencies by running npm ci
.
Unit tests can be found under the test/
directory. Run them tests as follows:
npm run test
There are integration tests that will query the API. They can be found under the integration/
directory.
They require OAuth1 application credentials. To get valid credentials, visit the Tumblr OAuth Applications page.
Never share your credentials. They're secret!
Part of the suite can be run with just the consumer_key
, which is required:
TUMBLR_OAUTH_CONSUMER_KEY='--- valid consumer_key ---' \
npm run test:integration
To run the full suite, you must provide complete OAuth1 credentials. These full credentials can be
found by visiting the Tumblr API Console and
entering your OAuth Application consumer credentials. Note: You may need to set
https://api.tumblr.com/console/calls/user/info
as the default callback URL for you application.
It's recommended to create a dedicated application for testing this library.
Provide the full OAuth1 credentials as environment variables and run the integration test suite:
TUMBLR_OAUTH_CONSUMER_KEY='--- valid consumer_key ---' \
TUMBLR_OAUTH_CONSUMER_SECRET='--- valid consumer_secret ---' \
TUMBLR_OAUTH_TOKEN='--- valid token ---' \
TUMBLR_OAUTH_TOKEN_SECRET='--- valid token_key ---' \
npm run test:integration
The above tests query the API to read data, they won't make any changes.
There are additional tests that will write or modify data. Those tests are disabled by default and need to be enabled by changes to the test file. Be careful when running those tests and be sure the credentials are for a test account.