Skip to content

Commit

Permalink
3.1.0 Updated deps & tests (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirill-konshin committed Feb 2, 2017
1 parent a756f68 commit f4bf3cc
Show file tree
Hide file tree
Showing 35 changed files with 1,324 additions and 1,442 deletions.
8 changes: 4 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"!src/**/*"
],
"dependencies": {
"es6-promise": "^3.2.1",
"fetch": "^0.11.0",
"pubnub": "^3.14.4"
"es6-promise": "^4.0.5",
"fetch": "^2.0.2",
"pubnub": "^4.4.2"
},
"moduleType": [
"amd",
Expand All @@ -38,4 +38,4 @@
"type": "git",
"url": "git://github.com/ringcentral/ringcentral-js.git"
}
}
}
37 changes: 21 additions & 16 deletions build/ringcentral.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/ringcentral.js.map

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions build/ringcentral.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/ringcentral.min.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ module.exports = function(config) {

files: [
require.resolve('karma-chai-plugins/function-bind-polyfill'),
require.resolve('whatwg-fetch/fetch'),
require.resolve('es6-promise/dist/es6-promise.auto.js'),
require.resolve('whatwg-fetch/fetch'), //FIXME We need to add it manually for fetch-mock
require.resolve('fetch-mock/es5/client-browserified'),
require.resolve('es6-promise/dist/es6-promise.js'),
require.resolve('pubnub/modern/dist/pubnub.js')
require.resolve('pubnub/dist/web/pubnub.js')
].concat([
'./build/ringcentral.js'
]).concat(specs),
Expand Down
42 changes: 21 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ringcentral",
"version": "3.0.0",
"version": "3.1.0",
"scripts": {
"clean": "rm -rf build/*",
"build": "npm run clean && ./node_modules/.bin/webpack --display-modules --progress --colors --bail",
Expand All @@ -20,38 +20,38 @@
"hint": "jshint src/**/*.js"
},
"dependencies": {
"es6-promise": "^3.0.2",
"fetch-ponyfill": "^3.0.0",
"es6-promise": "^4.0.5",
"fetch-ponyfill": "^3.0.2",
"is-plain-object": "^2.0.1",
"object-assign": "^4.1.0",
"pubnub": "^3.16.3"
"pubnub": "^4.4.2"
},
"devDependencies": {
"chai": "^3.5.0",
"fetch-mock": "^5.5.0",
"fetch-mock": "^5.9.3",
"http-server": "^0.9.0",
"istanbul": "^0.4.1",
"istanbul": "^0.4.5",
"jsdoc-to-markdown": "^2.0.1",
"jshint": "^2.9.4",
"json-loader": "^0.5.4",
"karma": "^0.13.22",
"karma-chai-plugins": "^0.7.0",
"karma-chrome-launcher": "^0.2.3",
"karma-coverage": "^0.5.3",
"karma-firefox-launcher": "^0.1.7",
"karma": "^1.4.1",
"karma-chai-plugins": "^0.8.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.0.0",
"karma-html-reporter": "^0.2.6",
"karma-mocha": "^0.2.0",
"karma-mocha-reporter": "^2.0.0",
"karma-phantomjs-launcher": "^1.0.0",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.2",
"karma-phantomjs-launcher": "^1.0.2",
"karma-sourcemap-loader": "^0.3.5",
"karma-webpack": "^1.7.0",
"mocha": "^2.4.5",
"phantomjs-prebuilt": "^2.1.7",
"sinon": "^1.17.3",
"karma-webpack": "^2.0.2",
"mocha": "^3.2.0",
"phantomjs-prebuilt": "^2.1.14",
"sinon": "^1.17.7",
"sinon-chai": "^2.8.0",
"soap": "^0.13.0",
"webpack": "^1.12.14",
"whatwg-fetch": "^1.0.0"
"soap": "^0.18.0",
"webpack": "^1.14.0",
"whatwg-fetch": "^2.0.2"
},
"jsdoc2md": {
"separators": true,
Expand Down
2 changes: 1 addition & 1 deletion src/SDK.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var Constants = require("./core/Constants");
* @param {string} [options.appName]
* @param {string} [options.appVersion]
* @param {string} [options.redirectUri]
* @param {PUBNUB} [options.PUBNUB]
* @param {PubNub} [options.PubNub]
* @param {function(new:Promise)} [options.Promise]
* @param {Storage} [options.localStorage]
* @param {fetch} [options.fetch]
Expand Down
10 changes: 5 additions & 5 deletions src/core/Externals.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ var root = (typeof window !== "undefined" && window) ||

/**
* @constructor
* @param {PUBNUB} [options.PUBNUB]
* @param {PubNub} [options.PubNub]
* @param {function(new:Promise)} [options.Promise]
* @param {Storage} [options.localStorage]
* @param {fetch} [options.fetch]
* @param {function(new:Request)} [options.Request]
* @param {function(new:Response)} [options.Response]
* @param {function(new:Headers)} [options.Headers]
* @property {PUBNUB} PUBNUB
* @property {PubNub} PubNub
* @property {Storage} localStorage
* @property {function(new:Promise)} Promise
* @property {fetch} fetch
Expand All @@ -27,7 +27,7 @@ function Externals(options) {

options = options || {};

this.PUBNUB = options.PUBNUB || root.PUBNUB || pubnub;
this.PubNub = options.PubNub || root.PubNub || pubnub;
this.localStorage = options.localStorage || ((typeof root.localStorage !== 'undefined') ? root.localStorage : {});
this.Promise = options.Promise || root.Promise || (es6Promise && es6Promise.Promise);

Expand All @@ -50,8 +50,8 @@ function Externals(options) {
throw new Error('LocalStorage is missing');
}

if (!this.PUBNUB) {
throw new Error('PUBNUB is missing');
if (!this.PubNub) {
throw new Error('PubNub is missing');
}

}
Expand Down
8 changes: 3 additions & 5 deletions src/subscription/Subscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ Subscription.prototype.resubscribe = function() {
};

/**
* Remove subscription and disconnect from PUBNUB
* Remove subscription and disconnect from PubNub
* This method resets subscription at client side but backend is not notified
* @return {Subscription}
*/
Expand Down Expand Up @@ -344,7 +344,7 @@ Subscription.prototype._decrypt = function(message) {

if (this.subscription().deliveryMode.encryptionKey) {

message = this._externals.PUBNUB.crypto_obj.decrypt(message, this.subscription().deliveryMode.encryptionKey, {
message = this._pubnub.decrypt(message, this.subscription().deliveryMode.encryptionKey, {
encryptKey: false,
keyEncoding: 'base64',
keyLength: 128,
Expand Down Expand Up @@ -394,13 +394,11 @@ Subscription.prototype._subscribeAtPubnub = function() {
} else {

// Init from scratch
this._pubnub = this._externals.PUBNUB.init({
this._pubnub = new this._externals.PubNub({
ssl: true,
subscribe_key: deliveryMode.subscriberKey
});

this._pubnub.ready(); //TODO This may be not needed anymore

}

this._pubnubLastChannel = deliveryMode.address;
Expand Down
22 changes: 11 additions & 11 deletions src/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {

require("es6-promise").polyfill(); //FIXME Needed for Fetch Mock

var chai = require("chai");
var sinon = require("sinon");
var SDK = require("../SDK");
Expand All @@ -34,11 +36,6 @@

var expect = chai.expect;
var spy = sinon.spy;
var fetchMockOrig = fetchMock.fetchMock;

fetchMock.fetchMock = function(req) {
return fetchMockOrig(req.url, req); // For some reasons that's needed for TravisCI
};

function apiCall(method, path, json, status, statusText, headers) {

Expand All @@ -49,14 +46,16 @@

if (isJson && !headers) headers = {'Content-Type': 'application/json'};

fetchMock.once('http://whatever' + path, {

fetchMock.mock('http://whatever' + path, {
body: isJson ? JSON.stringify(json) : json,
status: status,
statusText: statusText,
headers: headers,
sendAsJson: false
}, {
method: method
method: method,
times: 1
});

}
Expand Down Expand Up @@ -186,10 +185,10 @@
server: 'http://whatever',
appKey: 'whatever',
appSecret: 'whatever',
Headers: fetchMock.Headers,
Request: fetchMock.Request,
Response: fetchMock.Response,
fetch: fetchMock.fetchMock,
Request: fetchMock.constructor.Request,
Response: fetchMock.constructor.Response,
Headers: fetchMock.constructor.Headers,
fetch: fetchMock.fetchMock.bind(fetchMock),
refreshDelayMs: 1
};

Expand Down Expand Up @@ -237,6 +236,7 @@
clean();
}).catch(function(e) {
clean();
console.error(e.stack);
throw e;
});

Expand Down
Loading

0 comments on commit f4bf3cc

Please sign in to comment.