diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bd1c1d..91b1810 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,62 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.0.0] - 2022-03-08 +### Added +- Functionalities: + - Added functionality to `http-client` for sending PUT requests. Kudos to [@ptlls](https://github.com/ptlls) +- Methods: + - ```CelsiusInstance.getSupportedCountries(userSecret)``` that returns the list of countries supported by Celsius. + - ```CelsiusInstance.health(message)``` checks the health of the server. Kudos to [@andreujuanc](https://github.com/andreujuanc) + - ```CelsiusInstance.getKycVerificationStatus(userId, userSecret)``` checks the KYC status, similar to existing `getKycStatus` method, but takes also `userId` as a parameter + and returns a response containing property `status` which shows the status of KYC and `reason` which states the reason for the status if needed. + - ```CelsiusInstance.startKycVerification(userId, documentType, userDocuments, userSecret)``` starts the KYC verification same as existing `verifyKyc` method, but it doesn't + create the user, but rather receives an existing user's id - `userId` as a parameter + - ```CelsiusInstance.createUser(user)``` which returns `userId` which can be used to manipulate user info and starting KYC verification. Also, the `user_token` property will be used as `userSecret` + - ```CelsiusInstance.updateUser(userId, user, userSecret)``` + - ```CelsiusInstance.updateUserEmail(email, userSecret)``` + - ```CelsiusInstance.confirmTermsOfUse(termsOfUseId, confirmationDate, userSecret)``` use to accept the latest terms of use. Kudos to [@ptlls](https://github.com/ptlls) +- Types: + - `CreateUser` with properties `first_name`, `last_name`, `middle_name`?, `email`?, `title`?, `date_of_birth`, + `citizenship`, `country`, `state`?, `city`, `zip`, `street`, `building_number`?, `flat_number`, `itin`?, national_id?, + `ssn`?, `gender`, `user_token` + - `UpdateUser` with properties `first_name`, `last_name`, `middle_name`?, `email`?,`title`?, `date_of_birth`, + `citizenship`,`country`,`state`?,`city`,`zip`, `street`,`building_number`?,`flat_number`?,`itin`?, + `national_id`?, `ssn`?, `gender`, + - `UpdateEmail` with `email` property, for updating user email. + - `CreateUserResponse` with properties `userId`, `userToken` + - `SupportedCountriesResponse` with properties `alpha2`, `alpha3`, `countryCallingCodes`, `currencies` + `emoji`, `ioc`, `languages`, `name` and `status` + - `KYCStatusResponse` with properties `status` and `reasons` +### Updated +- Updated methods: + - `getInterestRates` return type changed to `Promise` . Kudos to [@barathvk](https://github.com/barathvk) + - `getTransactionSummary`, pagination options parameter changed from `PaginationOptions` to `CelsiusPaginationOptions`. Kudos to [@crypto-diplodocus](https://github.com/crypto-diplodocus) and [@rbayliss](https://github.com/rbayliss) + - `getCoinTransactions`, pagination options changed from `PaginationOptions` to `CelsiusPaginationOptions`. Kudos to [@crypto-diplodocus](https://github.com/crypto-diplodocus) and [@rbayliss](https://github.com/rbayliss) +- Updated types: + - added `coin` property to `CelsiusWithdrawOptions` +- Updated dependencies: + - Bump `nokogiri` from 1.10.8 to 1.12.5 + - Bump `path-parse` from 1.0.6 to 1.0.7 + - Bump `addressable` from 2.5.2 to 2.8.0 + - Bump `hosted-git-info` from 2.7.1 to 2.8.9 + - Bump `lodash` from 4.17.19 to 4.17.21 + - Bump `axios` from 0.18.1 to 0.21.1 +### Deleted: +- Deleted methods: + - ```CelsiusInstance.createUser``` + - ```CelsiusInstance.getUsers``` + - ```CelsiusInstance.changeMetadata``` + - ```CelsiusInstance.changeWithdrawalAddress``` +- Deleted types: + - `PaginationOptions` + - `UserWithdrawalAddress` + - `UserMetadataResponse` + - `UserCreateResponse` + - `UsersResponse` + - `WithdrawalAddress` + - `InstitutionalUser` + ## [0.10.15] - 2020-12-23 - Adding a new property `amount_precise` to the `CelsiusTransactionRecord` type. It provides the exact transaction amount, without any rounding applied. - Fixing typos in jsdoc. Kudos to [@saginadir](https://github.com/saginadir) who noticed the typo and contributed code that fixes it! diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index e26c1aa..6ef6762 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -6,8 +6,8 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.5.2) - public_suffix (>= 2.0.2, < 4.0) + addressable (2.8.0) + public_suffix (>= 2.0.2, < 5.0) coffee-script (2.4.1) coffee-script-source execjs @@ -15,19 +15,34 @@ GEM colorator (1.1.0) commonmarker (0.17.13) ruby-enum (~> 0.5) - concurrent-ruby (1.1.4) - dnsruby (1.61.2) - addressable (~> 2.5) - em-websocket (0.5.1) + concurrent-ruby (1.1.9) + dnsruby (1.61.7) + simpleidn (~> 0.1) + em-websocket (0.5.2) eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) - ethon (0.11.0) - ffi (>= 1.3.0) + ethon (0.14.0) + ffi (>= 1.15.0) eventmachine (1.2.7) execjs (2.7.0) - faraday (0.15.4) + faraday (1.5.1) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0.1) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.1) + faraday-patron (~> 1.0) multipart-post (>= 1.2, < 3) - ffi (1.9.25) + ruby2_keywords (>= 0.0.4) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + ffi (1.15.3) forwardable-extended (2.6.0) gemoji (3.0.0) github-pages (193) @@ -185,7 +200,7 @@ GEM jekyll-seo-tag (~> 2.0) jekyll-titles-from-headings (0.5.1) jekyll (~> 3.3) - jekyll-watch (2.1.2) + jekyll-watch (2.2.1) listen (~> 3.0) jemoji (0.10.1) gemoji (~> 3.0) @@ -198,44 +213,53 @@ GEM rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) mercenary (0.3.6) - mini_portile2 (2.4.0) + mini_portile2 (2.6.1) minima (2.5.0) jekyll (~> 3.5) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) minitest (5.11.3) - multipart-post (2.0.0) - nokogiri (1.10.8) - mini_portile2 (~> 2.4.0) - octokit (4.13.0) + multipart-post (2.1.1) + nokogiri (1.12.5) + mini_portile2 (~> 2.6.1) + racc (~> 1.4) + octokit (4.21.0) sawyer (~> 0.8.0, >= 0.5.3) + faraday (>= 0.9) pathutil (0.16.2) forwardable-extended (~> 2.6) public_suffix (2.0.5) - rb-fsevent (0.10.3) - rb-inotify (0.10.0) + rb-fsevent (0.11.0) + rb-inotify (0.10.1) + racc (1.5.2) ffi (~> 1.0) rouge (2.2.1) ruby-enum (0.7.2) i18n + ruby2_keywords (0.0.4) ruby_dep (1.5.0) rubyzip (2.0.0) - safe_yaml (1.0.4) - sass (3.7.2) + safe_yaml (1.0.5) + sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sawyer (0.8.1) - addressable (>= 2.3.5, < 2.6) - faraday (~> 0.8, < 1.0) + sawyer (0.8.2) + addressable (>= 2.3.5) + faraday (> 0.8, < 2.0) + simpleidn (0.2.1) + unf (~> 0.1.4) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) thread_safe (0.3.6) - typhoeus (1.3.1) + typhoeus (1.4.0) ethon (>= 0.9.0) tzinfo (1.2.5) thread_safe (~> 0.1) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.7) unicode-display_width (1.4.0) PLATFORMS diff --git a/index.d.ts b/index.d.ts index 17ec6c6..790805c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -80,12 +80,28 @@ declare module 'celsius-sdk' { amount_in_usd: string; } + interface SupportedCountriesResponse { + alpha2: string; + alpha3: string; + countryCallingCodes: string[]; + currencies: string[]; + emoji: string; + ioc: string; + languages: string[]; + name: string; + status: string; + } + + interface KYCStatusResponse { + status: string, + reasons: object + } + + /** * Celsius Withdraw Options */ interface CelsiusWithdrawOptions { - /** The coin you wish to withdraw */ - coin: string; /** This is the withdrawal amount you want */ amount: number; /** This is destination address that you want the tokens to be deposited */ @@ -187,15 +203,6 @@ declare module 'celsius-sdk' { document_back_image: string; } - interface PaginationOptions { - page?: number; - limit?: number; - email?: string; - name?: string; - orderBy?: string; - direction?: string; - } - interface User { id: string; auth0_user_id: string; @@ -233,47 +240,56 @@ declare module 'celsius-sdk' { kyc_status: KycStatus; } - interface UserMetadataResponse { - message: 'User`s metadata has been updated'; - } - - interface UserCreateResponse { - message: 'User has been created'; - } - - interface UserWithdrawalAddress { - user_id: string; - coin: string; - bitgo_wallet_id: string; - address: string; - manually_set: boolean; - created_at: string; - updated_at: string; - version: number; - } - - interface UsersResponse { - users: { - total: number, - results: User[] - } - } - - interface WithdrawalAddress { - short: string, - address: string - } - - interface InstitutionalUser { - companyName: string; - email: string; - country: string; - state?: string; - taxNumber?: string; - contactPerson: string; - contactEmail: string; - note?: string; - withdrawalWallets: WithdrawalAddress[]; + interface CreateUser { + first_name: string, + last_name: string, + middle_name?: string, + email?: string, + title?: string, + date_of_birth: Date, + citizenship: string, + country: string, + state?: string, + city: string, + zip: string, + street: string, + building_number?: string, + flat_number?: string, + itin?: string, + national_id?: string, + ssn?: string, + gender: string, + user_token: string + } + + interface UpdateUser { + first_name: string, + last_name: string, + middle_name?: string, + email?: string, + title?: string, + date_of_birth: Date, + citizenship: string, + country: string, + state?: string, + city: string, + zip: string, + street: string, + building_number?: string, + flat_number?: string, + itin?: string, + national_id?: string, + ssn?: string, + gender: string, + } + + interface UpdateEmail{ + email: string + } + + interface CreateUserResponse { + userId: string, + userToken: string } interface CelsiusInstance { @@ -284,19 +300,23 @@ declare module 'celsius-sdk' { getBalanceSummary(userSecret: string): Promise; getCoinBalance(coin: string, userSecret: string): Promise; getInterestSummary(userSecret: string): Promise; - getTransactionSummary(pagination: CelsiusPagination, userSecret: string): Promise; - getCoinTransactions(coin: string, pagination: CelsiusPagination, userSecret: string): Promise; + getTransactionSummary(pagination: CelsiusPaginationOptions, userSecret: string): Promise; + getCoinTransactions(coin: string, pagination: CelsiusPaginationOptions, userSecret: string): Promise; getDeposit(coin: string, userSecret: string): Promise<{address: string}>; withdraw(coin: string, formFields: CelsiusWithdrawOptions, userSecret: string): Promise<{transaction_id: string}>; getWithdrawalAddressForCoin(coin: string, userSecret: string): Promise<{address: string}> getWithdrawalAddresses(userSecret: string): Promise getTransactionStatus(transaction: string, userSecret: string): Promise; - getUsers(pagination: PaginationOptions, userSecret: string): Promise; - changeMetadata(id: string, data: object, userSecret: string): Promise; - changeWithdrawalAddress(id: string, data: WithdrawalAddress, userSecret: string): Promise; - createUser(user: InstitutionalUser, userSecret: string): Promise - getInterestRates(): Promise + getInterestRates(): Promise getStatistics(userSecret: string, timestamp?: string): Promise + confirmTermsOfUse(termsOfUseId: string, confirmationDate: Date, userSecret: string): Promise<{success: boolean}> + health(message: string): Promise<{originalMessage: string}> + getSupportedCountries(userSecret:string): Promise + getKycVerificationStatus(userId:string, userSecret:string):Promise + startKycVerification(userId:string, documentType: string, userDocuments: CelsiusKycFiles, userSecret: string):Promise<{message: string}> + createUser(user: CreateUser): Promise + updateUser(userId:string, user:UpdateUser, userSecret: string):Promise<{status:boolean}> + updateUserEmail(email:UpdateEmail, userSecret:string):Promise<{status:boolean}> } interface InterestRates { diff --git a/lib/consts.js b/lib/consts.js index 0dabf7d..e51d24b 100644 --- a/lib/consts.js +++ b/lib/consts.js @@ -20,17 +20,16 @@ const AUTH_METHODS = { /** * @description Paths to the Wallet API. - * @type {{KYC: string, SUPPORTED_CURRENCIES: string, BALANCE_SUMMARY: string, TRANSACTIONS_SUMMARY: string, COIN_BALANCE: (function(*): string), COIN_TRANSACTIONS: (function(*): string), DEPOSIT: (function(*): string), WITHDRAW: (function(*): string), TRANSACTION_STATUS: (function(*): string)}} + * @type {{KYC: string, SUPPORTED_CURRENCIES: string, SUPPORTED_COUNTRIES: string, BALANCE_SUMMARY: string, TRANSACTIONS_SUMMARY: string, TERMS_OF_USE: string, COIN_BALANCE: (function(*): string), COIN_TRANSACTIONS: (function(*): string), DEPOSIT: (function(*): string), WITHDRAW: (function(*): string), TRANSACTION_STATUS: (function(*): string), HEALTH: (function(*): string), KYC_VERIFICATION: (function(*): string)}} * @constant */ const PATHS = { KYC: '/kyc', SUPPORTED_CURRENCIES: '/util/supported_currencies', + SUPPORTED_COUNTRIES: '/util/countries', BALANCE_SUMMARY: '/wallet/balance', INTEREST_SUMMARY: '/wallet/interest', TRANSACTIONS_SUMMARY: '/wallet/transactions', - USERS: '/institutional/users', - CREATE_USER: '/institutional/user', INTEREST_RATES: '/util/interest/rates', COIN_BALANCE: (coin) => { return '/wallet/' + coin + '/balance' @@ -51,13 +50,18 @@ const PATHS = { TRANSACTION_STATUS: (transaction) => { return '/wallet/transactions/' + transaction + '/status' }, - CHANGED_METADATA: (id) => { - return `/institutional/${id}/metadata` + STATISTICS: '/util/statistics', + HEALTH: (message) => { + return '/health/echo/' + message }, - CHANGE_WITHDRAWAL_ADDRESS: (id) => { - return `/institutional/${id}/withdrawal-address` + TERMS_OF_USE: '/terms-of-use', + KYC_VERIFICATION: (id) => { + return `/users/${id}/kyc` }, - STATISTICS: '/util/statistics' + USERS: '/users', + UPDATE_USER: (id) => { + return `/users/${id}` + } } const MAX_UPLOAD_SIZE = 25485760 diff --git a/lib/core.js b/lib/core.js index 69e58e9..662efeb 100644 --- a/lib/core.js +++ b/lib/core.js @@ -12,6 +12,16 @@ const { ERROR_MESSAGES, CelsiusSDKError } = require('./errors') * Passed | User was successfully verified * Rejected | User has failed verification */ +/** + * @typedef {object} KYCStatusResponse + * @param status {string} + * @param reasons {array} + */ + +/** + * @typedef {object} StartKYCVerificationResponse + * @param message {string} + */ /** * @typedef {object} BalanceResponse @@ -31,7 +41,6 @@ const { ERROR_MESSAGES, CelsiusSDKError } = require('./errors') /** * @typedef {object} StatisticsResponse * @description Contains statistical data about users. - * * @property {string | number} depositCount - Contains number of deposits made by the user * @property {Object} depositAmount - Contains total amount deposited per coin as well as total amount deposited in usd * @property {string | number} withdrawalCount - Contains number of withdrawals made by the user @@ -40,6 +49,19 @@ const { ERROR_MESSAGES, CelsiusSDKError } = require('./errors') * @property {Object} interestAmount - Contains total amount earned per coin as well as total amount earned in usd */ +/** + * @typedef {object} SupportedCountriesResponse + * @description Contains the array of countries Celsius supports + * + * @property {array} countries - List of supported countries + */ + +/** + * @typedef {object} UpdateToUResponse + * @description Returns whether or not the ToU were accepted successfully. + * @property {boolean} success + */ + /** * @typedef {Object} Pagination * @property {number} page - Which page will be returned @@ -87,6 +109,11 @@ const { ERROR_MESSAGES, CelsiusSDKError } = require('./errors') * @property {function} verifyKyc - Method for sending POST requests. Data is transmitted using multipart/form-data */ +/** + * @typedef {Object} EchoResponse + * @property {string} originalMessage + */ + /** * Celsius js SDK Core * @module celsius-js-sdk/core @@ -381,25 +408,6 @@ const Celsius = function (config) { return httpClient.get(PATHS.TRANSACTION_STATUS(transaction), null, userSecret) }, - getUsers: function (pagination, userSecret) { - return httpClient.get(PATHS.USERS, pagination, userSecret) - }, - - changeMetadata: function (id, data, userSecret) { - return httpClient.post(PATHS.CHANGED_METADATA(id), data, null, userSecret) - }, - - changeWithdrawalAddress: function (id, data, userSecret) { - return httpClient.post(PATHS.CHANGE_WITHDRAWAL_ADDRESS(id), data, null, userSecret) - }, - - createUser: function (user, userSecret) { - if (Array.isArray(user.withdrawalWallets)) { - user.withdrawalWallets = JSON.stringify(user.withdrawalWallets) - } - return httpClient.post(PATHS.CREATE_USER, user, null, userSecret) - }, - getInterestRates: function () { return httpClient.get(PATHS.INTEREST_RATES, null, null, null) }, @@ -417,6 +425,98 @@ const Celsius = function (config) { */ getStatistics: function (userSecret, timestamp = null) { return httpClient.get(PATHS.STATISTICS, { timestamp }, userSecret) + }, + /** + * Checks API health. + * @memberOf module:celsius-js-sdk/core + * @function health + * @param message {string} + * @returns { EchoResponse } + */ + health: function (message) { + return httpClient.get(PATHS.HEALTH(message), null, null) + }, + /** + * This method confirms if the given ToU have been accepted. + * + * @memberOf module:celsius-js-sdk/core + * @function confirmTermsOfUse + * @param termsOfUseId {string} Id of the ToU document to confirm + * @param confirmationDate {Date} Confirmation date + * @param userSecret {string} Represents a secret value used to uniquely identify users. Can be user-token or api-key. + * + * @returns { UpdateToUResponse } + */ + confirmTermsOfUse: function (termsOfUseId, confirmationDate, userSecret) { + return httpClient.put(PATHS.TERMS_OF_USE, { confirmation_date: confirmationDate, terms_of_use_id: termsOfUseId }, null, userSecret) + }, + /** + * Returns the list of supported countries + * @memberOf module:celsius-js-sdk/core + * @function getSupportedCountries + * @param userSecret {string} - Represents a secret value used to uniquely identify users. Can be user-token or api-key + * @returns { SupportedCountriesResponse } + */ + getSupportedCountries: function (userSecret) { + return httpClient.get(PATHS.SUPPORTED_COUNTRIES, null, userSecret) + }, + + /** + * Start KYC verification + * @memberOf module:celsius-js-sdk/core + * @function startKycVerification + * @param userId {string} + * @param documentType {string} + * @param userDocuments {object} + * @param userSecret {string} - Represents a secret value used to uniquely identify users. Can be user-token or api-key + * @returns {StartKYCVerificationResponse} + */ + startKycVerification: function (userId, documentType, userDocuments, userSecret) { + return httpClient.post(PATHS.KYC_VERIFICATION(userId), documentType, userDocuments, userSecret) + }, + /** + * Returns the status of KYC for a user. + * @memberOf module:celsius-js-sdk/core + * @function getKycVerificationStatus + * @param userId {string} Id of the user for which you wish to get KYC status + * @param userSecret {string} - Represents a secret value used to uniquely identify users. Can be user-token or api-key + * @returns { KYCStatusResponse } + */ + getKycVerificationStatus: function (userId, userSecret) { + return httpClient.get(PATHS.KYC_VERIFICATION(userId), null, userSecret) + }, + /** + * Creates a new user. + * @memberOf module:celsius-js-sdk/core + * @function createUser + * @param user {CreateUser} Data required for creating a user + * @returns {CreateUserResponse} + */ + createUser: function (user) { + return httpClient.post(PATHS.USERS, user, null, null) + }, + /** + * Update user. + * @memberOf module:celsius-js-sdk/core + * @function updateUser + * @param userId {string} + * @param user {UpdateUser} Data required for updating a user + * @param userSecret {string} - Represents a secret value used to uniquely identify users. Can be user-token or api-key + * @returns {UpdateUserResponse} + */ + updateUser: function (userId, user, userSecret) { + return httpClient.put(PATHS.UPDATE_USER(userId), user, null, userSecret) + }, + /** + * Update user's email. + * @memberOf module:celsius-js-sdk/core + * @function updateUserEmail + * @param email {UpdateEmail} New email address + * @param userSecret {string} - Represents a secret value used to uniquely identify users. Can be user-token or api-key + * @returns {UpdateUserResponse} + */ + updateUserEmail: function (email, userSecret) { + return httpClient.put(PATHS.USERS, email, null, userSecret) } } diff --git a/lib/http-client.js b/lib/http-client.js index e7ae4c2..a452f2c 100644 --- a/lib/http-client.js +++ b/lib/http-client.js @@ -9,6 +9,7 @@ const { ERROR_MESSAGES, CelsiusSDKError, ValidationError } = require('./errors') * @typedef {object} HttpClient * @property {function} get Method for sending GET requests * @property {function} post Method for sending POST requests. Data is transmitted using multipart/form-data + * @property {function} put Method for sending PUT requests. Data is transmitted using multipart/form-data */ /** @@ -147,6 +148,27 @@ const HttpClient = function (config) { return _dispatchAxiosRequest('POST', path, headers, formData) }) + }, + + /** + * Sends a HTTP PUT request. + * + * @function put + * + * @param {string} path - Endpoint path + * @param {object} formFields - Form fields to be sent + * @param {object} files - Files to be sent + * @param {string} userSecret - User's secret token or api-key + * + * @return {Promise} Response + */ + put: function (path, formFields, files, userSecret) { + return util.getFormData(formFields, files).then((formData) => { + let headers = _getHeaders({ userSecret }) + headers = formData.getHeaders(headers) + + return _dispatchAxiosRequest('PUT', path, headers, formData) + }) } } } diff --git a/package.json b/package.json index 9e90ac9..39480a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "celsius-sdk", - "version": "0.10.15", + "version": "1.0.0", "author": { "name": "Celsius Network", "email": "", @@ -25,7 +25,7 @@ "test": "echo Passed;" }, "dependencies": { - "axios": "^0.18.1", + "axios": "^0.21.1", "form-data": "^2.3.3" }, "devDependencies": { diff --git a/test/test.js b/test/test.js index 2c76508..4718ca0 100644 --- a/test/test.js +++ b/test/test.js @@ -108,6 +108,13 @@ describe('SDK Test', async function () { let { interestRates } = await instance.getInterestRates() expect(interestRates).to.be.a('array') }) + + it('Should returns a copy of the message', async () => { + const message = 'celsius' + let { originalMessage } = await instance.health(message) + expect(originalMessage).to.be.a('string') + expect(e.message).to.be.equal(message) + }) }) function keysToUpperCase(obj) { diff --git a/yarn.lock b/yarn.lock index cabb941..787c400 100644 --- a/yarn.lock +++ b/yarn.lock @@ -111,13 +111,12 @@ atob@^2.1.1: resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== -axios@^0.18.1: - version "0.18.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.18.1.tgz#ff3f0de2e7b5d180e757ad98000f1081b87bcea3" - integrity sha512-0BfJq4NSfQXd+SkFdrvFbG7addhYSBA2mQwISr46pD6E5iqkWg02RAs8vyTT/j0RTnoYmeXauBuSv1qKwR179g== +axios@^0.21.1: + version "0.21.1" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8" + integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA== dependencies: - follow-redirects "1.5.10" - is-buffer "^2.0.2" + follow-redirects "^1.10.0" babylon@7.0.0-beta.19: version "7.0.0-beta.19" @@ -372,12 +371,6 @@ debug@3.2.6: dependencies: ms "^2.1.1" -debug@=3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" - dependencies: - ms "2.0.0" - debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" @@ -808,12 +801,10 @@ flat@^4.1.0: dependencies: is-buffer "~2.0.3" -follow-redirects@1.5.10: - version "1.5.10" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a" - integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ== - dependencies: - debug "=3.1.0" +follow-redirects@^1.10.0: + version "1.13.1" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.1.tgz#5f69b813376cee4fd0474a3aba835df04ab763b7" + integrity sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg== for-in@^1.0.2: version "1.0.2" @@ -972,8 +963,9 @@ homedir-polyfill@^1.0.1: parse-passwd "^1.0.0" hosted-git-info@^2.1.4: - version "2.7.1" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" + version "2.8.9" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" + integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== iconv-lite@^0.4.24: version "0.4.24" @@ -1054,11 +1046,6 @@ is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" -is-buffer@^2.0.2: - version "2.0.4" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.4.tgz#3e572f23c8411a5cfd9557c849e3665e0b290623" - integrity sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A== - is-buffer@~2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.3.tgz#4ecf3fcf749cbd1e472689e109ac66261a25e725" @@ -1320,9 +1307,9 @@ locate-path@^3.0.0: path-exists "^3.0.0" lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5: - version "4.17.19" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b" - integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ== + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== log-symbols@2.2.0: version "2.2.0" @@ -1700,8 +1687,9 @@ path-key@^2.0.0, path-key@^2.0.1: resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" path-parse@^1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" + version "1.0.7" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== path-type@^2.0.0: version "2.0.0"