Skip to content

Crubin/remove request promise #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Jun 1, 2017
Merged

Conversation

caitlinrubin-optimizely
Copy link
Contributor

No description provided.

package.json Outdated
@@ -21,15 +21,17 @@
"homepage": "https://github.com/optimizely/javascript-sdk#readme",
"dependencies": {
"es6-promise": "^3.3.1",
"optimizely-server-sdk": "^1.3.0"
"optimizely-server-sdk": "^1.3.0",
"xmlhttprequest": "^1.8.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed? If it's for tests, please move it to devDependencies

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's used in event_dispatcher/index.js in the toQueryString method -- should I just copy that over?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this library xmlhttprequest used in the toQueryString method

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O sorry I thought you meant optimizely-server-sdk -- still getting used to reading these git diffs -- you're right I removed it

package.json Outdated
@@ -21,15 +21,17 @@
"homepage": "https://github.com/optimizely/javascript-sdk#readme",
"dependencies": {
"es6-promise": "^3.3.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can get rid of this dependency now

@@ -0,0 +1,92 @@
/**
* Copyright 2016-2017, Optimizely
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should just say 2017

package.json Outdated
},
"devDependencies": {
"chai": "^3.5.0",
"eslint": "^2.9.0",
"json-loader": "^0.5.4",
"mocha": "^2.5.3",
"sinon": "^1.17.4",
"webpack": "^1.13.1"
"webpack": "^1.13.1",
"lodash": "4.13.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please alphabetize these

@@ -0,0 +1,266 @@
/**
* Copyright 2016-2017, Optimizely
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should just say 2017

var callback = sinon.spy();
eventDispatcher.dispatchEvent(eventObj, callback);
requests[ 0 ].respond([ 200 , {}, '{"url":"https://cdn.com/event","body":{"id":123},"httpVerb":"POST","params":{"testParam":"testParamValue"}}' ]);
done();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once you call done() the funciton will exit, meaning the assertion you are making below won't get executed.

var callback = sinon.spy();
eventDispatcher.dispatchEvent(eventObj, callback);
requests[ 0 ].respond([ 200 , {}, '{"url":"https://cdn.com/event","httpVerb":"GET"' ]);
done();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

.travis.yml Outdated
@@ -9,3 +9,8 @@ branches:
install: "npm install"
script:
- "npm test"
addons:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't include these in the repo, can you revert this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be added to the repo's config settings. We shouldn't check this in!

CHANGELOG Outdated
* Bump optimizely-server-sdk to version 1.3.1, which includes:
- Minor performance improvements.
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave an empty line between these

CHANGELOG Outdated
@@ -1,4 +1,11 @@
-------------------------------------------------------------------------------
1.4.1
-------------------------------------------------------------------------------
* Switched to karma for testing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're also getting rid of es6-promise

@@ -0,0 +1,78 @@
// Karma configuration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be .gitignored, I think, since it is generated

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason this file is still showing up

@@ -0,0 +1,16 @@
module.exports = function (grunt) {
grunt.initConfig({
karma: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we configure it to run on chrome by default, instead of Phantom

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have it run on chrome by default instead of Phantom

@@ -1,5 +1,5 @@
/**
* Copyright 2016-2017, Optimizely
* Copyright 2017, Optimizely
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should say 2016-2017 because the file was created in 2016, and was modified again in 2017.

@@ -24,40 +23,36 @@ module.exports = {
* Sample event dispatcher implementation for tracking impression and conversions
* Users of the SDK can provide their own implementation
* @param {Object} eventObj
* @return {Promise<Object>}
* @param {function} callback
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{Function}

@@ -1,4 +1,5 @@
var webpack = require('webpack');
var path = require('path');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed anymore

@@ -16,4 +17,12 @@ module.exports = {
library: 'optimizelyClient',
libraryTarget: 'umd'
},
module: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this after upgrading to webpack 2

Copy link
Contributor

@mikeproeng37 mikeproeng37 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there, just a few small changes left.

@@ -0,0 +1,78 @@
// Karma configuration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason this file is still showing up

req.setRequestHeader('Content-Type', 'application/json');
req.onreadystatechange = function() {
if (req.readyState === 4 && callback && typeof callback === 'function') {
callback(JSON.stringify(params));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to stringify the params here.

req.open(POST_METHOD, url, true);
req.setRequestHeader('Content-Type', 'application/json');
req.onreadystatechange = function() {
if (req.readyState === 4 && callback && typeof callback === 'function') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Can you make 4 a constant and use the constance instead

tests.js Outdated
@@ -1,5 +1,5 @@
/**
* Copyright 2016-2017, Optimizely
* Copyright 2017, Optimizely
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should still say 2016-2017

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should still say 2016-2018

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops 2016-2017

@@ -0,0 +1,16 @@
module.exports = function (grunt) {
grunt.initConfig({
karma: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have it run on chrome by default instead of Phantom

Copy link
Contributor

@mikeproeng37 mikeproeng37 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. We should move the travis credentials out of the source

.travis.yml Outdated
@@ -9,3 +9,8 @@ branches:
install: "npm install"
script:
- "npm test"
addons:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be added to the repo's config settings. We shouldn't check this in!

Copy link
Contributor

@mikeproeng37 mikeproeng37 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, is great to see all the cross browser tests running!

Just a few small things and we are all set!

tests.js Outdated
@@ -1,5 +1,5 @@
/**
* Copyright 2016-2017, Optimizely
* Copyright 2017, Optimizely
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should still say 2016-2018

tests.js Outdated
@@ -1,5 +1,5 @@
/**
* Copyright 2016-2017, Optimizely
* Copyright 2017, Optimizely
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops 2016-2017

.travis.yml Outdated
@@ -1,11 +1,14 @@
language: node_js
node_js:
- "5"
- "0.10"
- "node"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What version is node , does that point to latest node? If so please also add node 6 here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep node is "the latest stable Node.js release" -- I can add 6

Copy link
Contributor

@mikeproeng37 mikeproeng37 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling b461c35 on crubin/removeRequestPromise into ** on master**.

2 similar comments
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling b461c35 on crubin/removeRequestPromise into ** on master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling b461c35 on crubin/removeRequestPromise into ** on master**.

karma.bs.conf.js Outdated

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be true since we are running on the cloud

karma.bs.conf.js Outdated


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be false as we don't need watching in BS tests

@coveralls
Copy link

coveralls commented Jun 1, 2017

Coverage Status

Changes Unknown when pulling 24b1c8b on crubin/removeRequestPromise into ** on master**.

@coveralls
Copy link

coveralls commented Jun 1, 2017

Coverage Status

Changes Unknown when pulling 7c2df7f on crubin/removeRequestPromise into ** on master**.

@mikeproeng37 mikeproeng37 merged commit b39740c into master Jun 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants