You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by benkeen <gi...@git.apache.org> on 2015/04/23 00:52:34 UTC
[GitHub] couchdb-fauxton pull request: Verify install page converted to Rea...
GitHub user benkeen opened a pull request:
https://github.com/apache/couchdb-fauxton/pull/393
Verify install page converted to React
This converts the Verify Install page to React.
@robertkowalski, the one thing I had trouble with was writing a decent test for `actions.startVerification()`. I couldn't override the model that does all the async tests to the server. So instead, this relies on the other store, React + existing nightwatch tests confirming the functionality.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/benkeen/couchdb-fauxton verify-install-react
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/couchdb-fauxton/pull/393.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #393
----
commit a881b90a9450e6c8c240af18561a9134b4ebac67
Author: Ben Keen <be...@gmail.com>
Date: 2015-04-20T23:47:38Z
Initial pass; converted to React
commit e8e4e33660d0cd2818b15755b982d4f22070c1aa
Author: Ben Keen <be...@gmail.com>
Date: 2015-04-22T22:48:54Z
tests added
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Verify install page converted to Rea...
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/393#discussion_r28951556
--- Diff: app/addons/verifyinstall/tests/componentsSpec.js ---
@@ -0,0 +1,136 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+ 'app',
+ 'api',
+ 'react',
+ 'testUtils',
+ 'addons/verifyinstall/constants',
+ 'addons/verifyinstall/components.react'
+
+], function (app, FauxtonAPI, React, testUtils, Constants, Components) {
+ FauxtonAPI.router = new FauxtonAPI.Router([]);
+
+ var assert = testUtils.assert;
+ var ReactTestUtils = React.addons.TestUtils;
+
+
+ describe('VerifyInstallResults', function () {
+ var container, el;
+
+ var tests = [
+ { key: 'CREATE_DATABASE', id: 'js-test-create-db' },
+ { key: 'CREATE_DOCUMENT', id: 'js-test-create-doc' },
+ { key: 'UPDATE_DOCUMENT', id: 'js-test-update-doc' },
+ { key: 'DELETE_DOCUMENT', id: 'js-test-delete-doc' },
+ { key: 'CREATE_VIEW', id: 'js-test-create-view' },
+ { key: 'REPLICATION', id: 'js-test-replication' }
+ ];
+
+ var testResults = {};
+ _.each(tests, function (test) {
+ testResults[Constants.TESTS[test.key]] = { complete: false };
+ });
+
+ afterEach(function () {
+ React.unmountComponentAtNode(container);
+ });
+
+ it('confirm all result fields blank before tests ran', function () {
+ container = document.createElement('div');
+ el = ReactTestUtils.renderIntoDocument(React.createElement(Components.VerifyInstallResults, {testResults: testResults}), container);
+
+ _.each(tests, function (test) {
+ assert.equal($(el.getDOMNode()).find('#' + test.id).html(), '');
+ });
+ });
+
+ it('confirm each result field shows success after successful test', function () {
+ _.each(tests, function (test) {
--- End diff --
Sidenote: I don't get the overuse of `_.each` as we have native `.forEach` in JS for years:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Verify install page converted to Rea...
Posted by michellephung <gi...@git.apache.org>.
Github user michellephung commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/393#discussion_r29608267
--- Diff: app/addons/verifyinstall/stores.js ---
@@ -0,0 +1,99 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+ 'api',
+ 'addons/verifyinstall/constants',
+ 'addons/verifyinstall/actiontypes'
+],
+
+function (FauxtonAPI, Constants, ActionTypes) {
+
+ var VerifyInstallStore = FauxtonAPI.Store.extend({
+ initialize: function () {
+ this.reset();
+ },
+
+ reset: function () {
+ this._isVerifying = false;
+
+ // reset all the tests
+ this._tests = {};
+ _.each(Object.keys(Constants.TESTS), function (key) {
+ this._tests[Constants.TESTS[key]] = { complete: false };
+ }, this);
+ },
+
+ startVerification: function () {
+ this._isVerifying = true;
+ },
+
+ stopVerification: function () {
+ this._isVerifying = false;
+ },
+
+ checkIsVerifying: function () {
+ return this._isVerifying;
+ },
+
+ updateTestStatus: function (test, success) {
+
+ // shouldn't ever occur since we're using constants for the test names
+ if (!_.has(this._tests, test)) {
+ throw new Error('Invalid test name passed to updateTestStatus()');
+ }
--- End diff --
nice!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Verify install page converted to Rea...
Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/393#discussion_r29598085
--- Diff: app/addons/verifyinstall/tests/actionsSpec.js ---
@@ -0,0 +1,33 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+ 'app',
+ 'api',
+ 'testUtils',
+ 'addons/verifyinstall/stores',
+ 'addons/verifyinstall/actiontypes'
+], function (app, FauxtonAPI, testUtils, Stores, ActionTypes) {
+
+ var assert = testUtils.assert;
+
+ describe('Verify Install Actions', function () {
+
+ it('resets the store when action called', function () {
+ var spy = sinon.spy(Stores.verifyInstallStore, 'reset');
+ FauxtonAPI.dispatch({ type: ActionTypes.VERIFY_INSTALL_RESET });
+ assert.ok(spy.calledOnce);
+ });
+
+ });
+
--- End diff --
Exactly. I went down that route and ended up spending a lot of time fussing around with mocking - so decided against it & just included the end-to-end Nightwatch test.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Verify install page converted to Rea...
Posted by sebastianrothbucher <gi...@git.apache.org>.
Github user sebastianrothbucher commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/393#discussion_r29503015
--- Diff: app/addons/verifyinstall/tests/componentsSpec.js ---
@@ -0,0 +1,136 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+ 'app',
+ 'api',
+ 'react',
+ 'testUtils',
+ 'addons/verifyinstall/constants',
+ 'addons/verifyinstall/components.react'
+
+], function (app, FauxtonAPI, React, testUtils, Constants, Components) {
+ FauxtonAPI.router = new FauxtonAPI.Router([]);
+
+ var assert = testUtils.assert;
+ var ReactTestUtils = React.addons.TestUtils;
+
+
+ describe('VerifyInstallResults', function () {
+ var container, el;
+
+ var tests = [
+ { key: 'CREATE_DATABASE', id: 'js-test-create-db' },
+ { key: 'CREATE_DOCUMENT', id: 'js-test-create-doc' },
+ { key: 'UPDATE_DOCUMENT', id: 'js-test-update-doc' },
+ { key: 'DELETE_DOCUMENT', id: 'js-test-delete-doc' },
+ { key: 'CREATE_VIEW', id: 'js-test-create-view' },
+ { key: 'REPLICATION', id: 'js-test-replication' }
+ ];
+
+ var testResults = {};
+ _.each(tests, function (test) {
+ testResults[Constants.TESTS[test.key]] = { complete: false };
+ });
+
+ afterEach(function () {
+ React.unmountComponentAtNode(container);
+ });
+
+ it('confirm all result fields blank before tests ran', function () {
+ container = document.createElement('div');
+ el = ReactTestUtils.renderIntoDocument(React.createElement(Components.VerifyInstallResults, {testResults: testResults}), container);
+
--- End diff --
Just a general remark: ReactTestUtils.renderIntoDocument ignores the container param - see https://github.com/facebook/react/blob/master/src/test/ReactTestUtils.js?source=c#L46
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Verify install page converted to Rea...
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/393#discussion_r28950628
--- Diff: app/addons/verifyinstall/components.react.jsx ---
@@ -0,0 +1,145 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+ 'app',
+ 'api',
+ 'react',
+ 'addons/verifyinstall/constants',
+ 'addons/verifyinstall/resources',
+ 'addons/verifyinstall/actions',
+ 'addons/verifyinstall/stores'
+],
+function (app, FauxtonAPI, React, Constants, VerifyInstall, Actions, Stores) {
+
+ var store = Stores.verifyInstallStore;
+
+
+ var VerifyInstallController = React.createClass({
+ getInitialState: function () {
+ return this.getStoreState();
+ },
+
+ getStoreState: function () {
+ return {
+ isVerifying: store.checkIsVerifying(),
+ testResults: store.getTestResults()
+ };
+ },
+
+ startVerification: function () {
+ Actions.startVerification();
+ },
+
+ onChange: function () {
+ this.setState(this.getStoreState());
+ },
+
+ componentDidMount: function () {
+ store.on('change', this.onChange, this);
+ },
+
+ componentWillUnmount: function () {
+ store.off('change', this.onChange);
+ },
+
+ render: function () {
+ return (
+ <div>
+ <VerifyInstallButton verify={this.startVerification} isVerifying={this.state.isVerifying} />
+ <VerifyInstallResults testResults={this.state.testResults} />
+ </div>
+ );
+ }
+ });
+
+
+ var VerifyInstallButton = React.createClass({
+ propTypes: {
+ verify: React.PropTypes.func.isRequired,
+ isVerifying: React.PropTypes.bool.isRequired
+ },
+
+ render: function () {
+ return (
+ <button id="start" className="btn btn-large btn-success" onClick={this.props.verify} disabled={this.props.isVerifying}>
+ {this.props.isVerifying ? 'Verifying' : 'Verify Installation'}
+ </button>
+ );
+ }
+ });
+
+
+ var VerifyInstallResults = React.createClass({
+ propTypes: {
+ testResults: React.PropTypes.object.isRequired
+ },
+
+ showTestResult: function (test) {
+ var result = '';
+ if (!this.props.testResults[test].complete) {
+ result = '';
+ } else if (this.props.testResults[test].success) {
+ result = <span>✓</span>;
+ } else {
+ result = <span>✗</span>;
+ }
+ return result;
+ },
--- End diff --
you can use early returns here instead of nesting ifs/elses
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Verify install page converted to Rea...
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/393#discussion_r28950927
--- Diff: app/addons/verifyinstall/stores.js ---
@@ -0,0 +1,101 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+ 'api',
+ 'addons/verifyinstall/constants',
+ 'addons/verifyinstall/actiontypes'
+],
+
+function (FauxtonAPI, Constants, ActionTypes) {
+
+ var VerifyInstallStore = FauxtonAPI.Store.extend({
+ initialize: function () {
+ this.reset();
+ },
+
+ reset: function () {
+ this._isVerifying = false;
+
+ // reset all the tests
+ this._tests = {};
+ var keys = ['CREATE_DATABASE', 'CREATE_DOCUMENT', 'UPDATE_DOCUMENT', 'DELETE_DOCUMENT', 'CREATE_VIEW', 'REPLICATION'];
+ _.each(keys, function (key) {
+ this._tests[Constants.TESTS[key]] = { complete: false };
+ }, this);
+ },
--- End diff --
something like
```
this._tests = Object.keys(Constants.TESTS).reduce(function (acc, el) {
acc[Constants.TESTS[key]] = { complete: false };
return acc;
}, {});
```
should do the trick so you don't have to hardcode all the keys again here
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Verify install page converted to Rea...
Posted by sebastianrothbucher <gi...@git.apache.org>.
Github user sebastianrothbucher commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/393#discussion_r29503190
--- Diff: app/addons/verifyinstall/tests/componentsSpec.js ---
@@ -0,0 +1,136 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
--- End diff --
normally, the "something.react.js" pattern might avoid it
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Verify install page converted to Rea...
Posted by sebastianrothbucher <gi...@git.apache.org>.
Github user sebastianrothbucher commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/393#discussion_r29503146
--- Diff: app/addons/verifyinstall/tests/changesStoreSpec.js ---
@@ -0,0 +1,51 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
--- End diff --
Why "changesStore"?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Verify install page converted to Rea...
Posted by sebastianrothbucher <gi...@git.apache.org>.
Github user sebastianrothbucher commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/393#discussion_r29502853
--- Diff: app/addons/verifyinstall/tests/actionsSpec.js ---
@@ -0,0 +1,33 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+ 'app',
+ 'api',
+ 'testUtils',
+ 'addons/verifyinstall/stores',
+ 'addons/verifyinstall/actiontypes'
+], function (app, FauxtonAPI, testUtils, Stores, ActionTypes) {
+
+ var assert = testUtils.assert;
+
+ describe('Verify Install Actions', function () {
+
+ it('resets the store when action called', function () {
+ var spy = sinon.spy(Stores.verifyInstallStore, 'reset');
+ FauxtonAPI.dispatch({ type: ActionTypes.VERIFY_INSTALL_RESET });
+ assert.ok(spy.calledOnce);
+ });
+
+ });
+
--- End diff --
Testing the actual run would be lots of mocking - not sure whether it would be worth it
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Verify install page converted to Rea...
Posted by michellephung <gi...@git.apache.org>.
Github user michellephung commented on the pull request:
https://github.com/apache/couchdb-fauxton/pull/393#issuecomment-98803019
+1
note: i like how this was organized
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Verify install page converted to Rea...
Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/393#discussion_r29462602
--- Diff: app/addons/verifyinstall/stores.js ---
@@ -0,0 +1,101 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+ 'api',
+ 'addons/verifyinstall/constants',
+ 'addons/verifyinstall/actiontypes'
+],
+
+function (FauxtonAPI, Constants, ActionTypes) {
+
+ var VerifyInstallStore = FauxtonAPI.Store.extend({
+ initialize: function () {
+ this.reset();
+ },
+
+ reset: function () {
+ this._isVerifying = false;
+
+ // reset all the tests
+ this._tests = {};
+ var keys = ['CREATE_DATABASE', 'CREATE_DOCUMENT', 'UPDATE_DOCUMENT', 'DELETE_DOCUMENT', 'CREATE_VIEW', 'REPLICATION'];
+ _.each(keys, function (key) {
+ this._tests[Constants.TESTS[key]] = { complete: false };
+ }, this);
+ },
--- End diff --
Good point.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Verify install page converted to Rea...
Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/393#discussion_r29598400
--- Diff: app/addons/verifyinstall/tests/componentsSpec.js ---
@@ -0,0 +1,136 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
--- End diff --
Oops, you're quite right. I'll remove this file.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Verify install page converted to Rea...
Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on the pull request:
https://github.com/apache/couchdb-fauxton/pull/393#issuecomment-98803971
Thanks @michellephung! Squashed and merged as 90c07fa
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Verify install page converted to Rea...
Posted by benkeen <gi...@git.apache.org>.
Github user benkeen closed the pull request at:
https://github.com/apache/couchdb-fauxton/pull/393
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Verify install page converted to Rea...
Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on the pull request:
https://github.com/apache/couchdb-fauxton/pull/393#issuecomment-98771781
Thanks @sebastianrothbucher! Good calls on the above.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Verify install page converted to Rea...
Posted by sebastianrothbucher <gi...@git.apache.org>.
Github user sebastianrothbucher commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/393#discussion_r29503123
--- Diff: app/addons/verifyinstall/tests/componentsSpec.js ---
@@ -0,0 +1,136 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
--- End diff --
did not get it at first - but: is this file not a compilation result? and the next file is the actual one (i.e. this one shhould also not be checked in?)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Verify install page converted to Rea...
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/393#discussion_r28950994
--- Diff: app/addons/verifyinstall/stores.js ---
@@ -0,0 +1,101 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+ 'api',
+ 'addons/verifyinstall/constants',
+ 'addons/verifyinstall/actiontypes'
+],
+
+function (FauxtonAPI, Constants, ActionTypes) {
+
+ var VerifyInstallStore = FauxtonAPI.Store.extend({
+ initialize: function () {
+ this.reset();
+ },
+
+ reset: function () {
+ this._isVerifying = false;
+
+ // reset all the tests
+ this._tests = {};
+ var keys = ['CREATE_DATABASE', 'CREATE_DOCUMENT', 'UPDATE_DOCUMENT', 'DELETE_DOCUMENT', 'CREATE_VIEW', 'REPLICATION'];
+ _.each(keys, function (key) {
+ this._tests[Constants.TESTS[key]] = { complete: false };
+ }, this);
+ },
+
+ startVerification: function () {
+ this._isVerifying = true;
+ },
+
+ stopVerification: function () {
+ this._isVerifying = false;
+ },
+
+ checkIsVerifying: function () {
+ return this._isVerifying;
+ },
+
+ updateTestStatus: function (test, success) {
+
+ // shouldn't ever occur since we're using constants for the test names
+ if (!_.has(this._tests, test)) {
+ console.error("Invalid test name passed to updateTestStatus()");
--- End diff --
in that case i would just do:
```js
throw new Error('Invalid test name passed to updateTestStatus()');
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Verify install page converted to Rea...
Posted by sebastianrothbucher <gi...@git.apache.org>.
Github user sebastianrothbucher commented on the pull request:
https://github.com/apache/couchdb-fauxton/pull/393#issuecomment-98142212
Looks great to me, +1 with the filename thing resolved (or made me get it)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---