Skip to content

Commit

Permalink
updated test setup and container components
Browse files Browse the repository at this point in the history
  • Loading branch information
John Edward committed Mar 26, 2018
1 parent 350b26c commit 4a60bfa
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ accounts-password@1.5.0
alanning:roles
accounts-base@1.4.2
shell-server@0.3.1
dispatch:mocha
dynamic-import
meteortesting:mocha
4 changes: 2 additions & 2 deletions .meteor/versions
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
accounts-base@1.4.2
accounts-password@1.5.1
alanning:roles@1.2.16
aldeed:browser-tests@0.1.1
allow-deny@1.1.0
autoupdate@1.4.0
babel-compiler@7.0.5
Expand All @@ -23,7 +22,6 @@ ddp-rate-limiter@1.0.7
ddp-server@2.1.2
deps@1.0.12
diff-sequence@1.1.0
dispatch:mocha@0.4.1
dynamic-import@0.3.0
ecmascript@0.10.5
ecmascript-runtime@0.5.0
Expand All @@ -46,6 +44,8 @@ localstorage@1.2.0
logging@1.1.19
meteor@1.8.4
meteor-base@1.3.0
meteortesting:browser-tests@0.1.2
meteortesting:mocha@0.5.0
minifier-css@1.3.1
minifier-js@2.3.3
minimongo@1.4.3
Expand Down
6 changes: 3 additions & 3 deletions imports/ui/components/dashboard/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Meteor } from 'meteor/meteor';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { createContainer } from 'meteor/react-meteor-data';
import { withTracker } from 'meteor/react-meteor-data';

import SideBar from './sidebar/sidebar';
import AppHeader from '../app/app_header';
Expand Down Expand Up @@ -43,7 +43,7 @@ Dashboard.propTypes = {
users: PropTypes.arrayOf(PropTypes.object),
};

export default createContainer(() => {
export default withTracker(() => {
/**
* Add subscription here
*/
Expand All @@ -53,4 +53,4 @@ export default createContainer(() => {
currentUser: Meteor.user(),
users: Meteor.users.find().fetch(),
};
}, Dashboard);
})(Dashboard);
6 changes: 3 additions & 3 deletions imports/ui/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Meteor } from 'meteor/meteor';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { createContainer } from 'meteor/react-meteor-data';
import { withTracker } from 'meteor/react-meteor-data';
import Loading from '../layouts/loading/loading';

class Index extends Component {
Expand Down Expand Up @@ -36,6 +36,6 @@ Index.propTypes = {
currentUser: PropTypes.object,
};

export default createContainer(() => ({
export default withTracker(() => ({
currentUser: Meteor.user(),
}), Index);
}))(Index);
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"version": "2.0.0",
"scripts": {
"start": "meteor run",
"test": "TEST_BROWSER_DRIVER=phantomjs meteor test --once --driver-package dispatch:mocha",
"test:watch": "TEST_WATCH=1 TEST_BROWSER_DRIVER=phantomjs meteor test --driver-package dispatch:mocha",
"pretest": "npm run lint --silent",
"test": "TEST_BROWSER_DRIVER=phantomjs meteor test --once --driver-package meteortesting:mocha",
"test:watch": "TEST_BROWSER_DRIVER=phantomjs TEST_WATCH=1 meteor test --driver-package meteortesting:mocha",
"lint": "eslint --ignore-path .eslintignore ."
},
"dependencies": {
Expand All @@ -23,13 +24,14 @@
"devDependencies": {
"chai": "^4.1.2",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"eslint": "4.18.2",
"eslint-config-airbnb": "16.1.0",
"eslint-plugin-import": "2.9.0",
"eslint-plugin-jsx-a11y": "6.0.3",
"eslint-plugin-react": "7.7.0",
"eslint-watch": "3.1.3",
"phantomjs-prebuilt": "^2.1.14",
"phantomjs-prebuilt": "^2.1.16",
"pre-commit": "^1.1.3",
"react-addons-test-utils": "^15.4.2"
},
Expand Down
6 changes: 5 additions & 1 deletion test/client/components/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/* eslint-disable import/no-unresolved */
import React from 'react';
import { mount } from 'enzyme';
import { mount, configure } from 'enzyme';
import { expect } from 'chai';
import Adapter from 'enzyme-adapter-react-16';
import Index from '../../../imports/ui/components/index';

// TODO: centralized this config
configure({ adapter: new Adapter() });

describe('App index', () => {
it('should render app layout', () => {
const wrapper = mount(<Index />);
Expand Down

0 comments on commit 4a60bfa

Please sign in to comment.