meeting-for-good
meeting-for-good copied to clipboard
Create Tests parameters and procedures.
I'd like to help out.
Hey @ZaynMalloc Tks for your interest! Do you have experience with Mocha.JS ?
Yes
Ok so the best approach is if you can, please PR the initial Mocha setup and will start building the tests from there. I you want to start boldly you can already propose the basics CRUDS tests!
thanks, I'm working on it right now
I cloned the repo. When I run npm run dev, I get an error, and I am stuck at the "Loading the application, please hold on page".
zach@zach-VirtualBox:~/Documents/Code/meeting-for-good$ npm run dev
> [email protected] dev /home/zach/Documents/Code/meeting-for-good
> cross-env NODE_ENV=development node -r dotenv/config ./build/app.js
(node:15997) DeprecationWarning: `open()` is deprecated in mongoose >= 4.11.0, use `openUri()` instead, or set the `useMongoClient` option if using `connect()` or `createConnection()`
Node.js listening on port 8080...'
webpack: wait until bundle finished: /client/icons-45593c095f97b647c1dbd3d4e3e5d7ff/favicon-32x32.png
The manifest has been written to /home/zach/Documents/Code/meeting-for-good/build/client/manifest.json
webpack built 55301891ac7083a277d9 in 48758ms
Hash: 55301891ac7083a277d9
Version: webpack 2.6.1
Time: 48758ms
Asset Size Chunks Chunk Names
bundle.55301891ac7083a277d9.js 542 kB 4 bundle
iconstats-45dbfeb4fc45f31ac12c.json 3.96 kB
44dfe8cc676882243911a3197a50169e.ttf 122 kB
5b761f2d1e4259ea6ac7ab3ebf7f3c49.ttf 123 kB
7f690e503a254e0b8349aec0177e07aa.ttf 120 kB
0.55301891ac7083a277d9.js 273 kB 0
1.55301891ac7083a277d9.js 136 kB 1
2.55301891ac7083a277d9.js 43.7 kB 2
3.55301891ac7083a277d9.js 5.52 kB 3
d033d092b4e29eac09d04698be37e148.gif 160 kB
vendor.55301891ac7083a277d9.js 4.52 MB 5 vendor
vendor.css 1.67 kB 4 bundle
0.55301891ac7083a277d9.js.map 248 kB 0
1.55301891ac7083a277d9.js.map 112 kB 1
2.55301891ac7083a277d9.js.map 46.1 kB 2
3.55301891ac7083a277d9.js.map 1.44 kB 3
bundle.55301891ac7083a277d9.js.map 563 kB 4 bundle
vendor.css.map 87 bytes 4 bundle
vendor.55301891ac7083a277d9.js.map 5.34 MB 5 vendor
chunk {0} 0.55301891ac7083a277d9.js, 0.55301891ac7083a277d9.js.map 255 kB {4} [rendered]
[./client/components/AvailabilityGrid/AvailabilityGrid.js] ./client/components/AvailabilityGrid/AvailabilityGrid.js 21.7 kB {0} [built]
[./client/components/BestTimeDisplay/BestTimeDisplay.js] ./client/components/BestTimeDisplay/BestTimeDisplay.js 11.6 kB {0} {1} [built]
[./client/components/EventDetailsComponent/EventDetailsComponent.js] ./client/components/EventDetailsComponent/EventDetailsComponent.js 21.7 kB {0} [built]
[./client/components/GuestInviteDrawer/GuestInviteDrawer.js] ./client/components/GuestInviteDrawer/GuestInviteDrawer.js 21.4 kB {0} {1} [built]
[./client/components/GuestInviteDrawer/GuestInviteDrawerRows.js] ./client/components/GuestInviteDrawer/GuestInviteDrawerRows.js 2.6 kB {0} {1} [built]
[./client/components/GuestInviteDrawer/GuestInviteUrlActions.js] ./client/components/GuestInviteDrawer/GuestInviteUrlActions.js 2.6 kB {0} {1} [built]
[./client/components/GuestInviteDrawer/guest-invite.css] ./client/components/GuestInviteDrawer/guest-invite.css 1.31 kB {0} {1} [built]
[./client/components/GuestInviteDrawer/guestInviteDrawerUtils.js] ./client/components/GuestInviteDrawer/guestInviteDrawerUtils.js 1.01 kB {0} {1} [built]
[./client/components/ParticipantsList/ParticipantsList.js] ./client/components/ParticipantsList/ParticipantsList.js 14.5 kB {0} {1} [built]
[./client/pages/EventDetails/EventDetails.js] ./client/pages/EventDetails/EventDetails.js 16.5 kB {0} [built]
[./client/pages/EventDetails/event-details.css] ./client/pages/EventDetails/event-details.css 1.31 kB {0} [built]
[./client/util/dates.utils.js] ./client/util/dates.utils.js 4.12 kB {0} {2} [built]
[./node_modules/material-ui/svg-icons/action/date-range.js] ./~/material-ui/svg-icons/action/date-range.js 966 bytes {0} {1} [built]
[./node_modules/material-ui/svg-icons/action/delete.js] ./~/material-ui/svg-icons/action/delete.js 856 bytes {0} {1} {2} [built]
[./node_modules/material-ui/svg-icons/content/add.js] ./~/material-ui/svg-icons/content/add.js 798 bytes {0} {1} [built]
+ 37 hidden modules
chunk {1} 1.55301891ac7083a277d9.js, 1.55301891ac7083a277d9.js.map 125 kB {4} [rendered]
[./client/components/BestTimeDisplay/BestTimeDisplay.js] ./client/components/BestTimeDisplay/BestTimeDisplay.js 11.6 kB {0} {1} [built]
[./client/components/DeleteModal/DeleteModal.js] ./client/components/DeleteModal/DeleteModal.js 9 kB {0} {1} [built]
[./client/components/EventCard/EventCard.js] ./client/components/EventCard/EventCard.js 10 kB {1} [built]
[./client/components/GuestInviteDrawer/GuestInviteDrawer.js] ./client/components/GuestInviteDrawer/GuestInviteDrawer.js 21.4 kB {0} {1} [built]
[./client/components/GuestInviteDrawer/GuestInviteDrawerRows.js] ./client/components/GuestInviteDrawer/GuestInviteDrawerRows.js 2.6 kB {0} {1} [built]
[./client/components/GuestInviteDrawer/GuestInviteUrlActions.js] ./client/components/GuestInviteDrawer/GuestInviteUrlActions.js 2.6 kB {0} {1} [built]
[./client/components/GuestInviteDrawer/guest-invite.css] ./client/components/GuestInviteDrawer/guest-invite.css 1.31 kB {0} {1} [built]
[./client/components/GuestInviteDrawer/guestInviteDrawerUtils.js] ./client/components/GuestInviteDrawer/guestInviteDrawerUtils.js 1.01 kB {0} {1} [built]
[./client/components/ParticipantsList/ParticipantsList.js] ./client/components/ParticipantsList/ParticipantsList.js 14.5 kB {0} {1} [built]
[./client/pages/Dashboard/dashboard.css] ./client/pages/Dashboard/dashboard.css 1.3 kB {1} [built]
[./client/pages/Dashboard/index.js] ./client/pages/Dashboard/index.js 14.8 kB {1} [built]
[./node_modules/css-loader/index.js?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]!./client/pages/Dashboard/dashboard.css] ./~/css-loader?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]!./client/pages/Dashboard/dashboard.css 2.1 kB {1} [built]
[./node_modules/material-ui/svg-icons/action/date-range.js] ./~/material-ui/svg-icons/action/date-range.js 966 bytes {0} {1} [built]
[./node_modules/material-ui/svg-icons/action/delete.js] ./~/material-ui/svg-icons/action/delete.js 856 bytes {0} {1} {2} [built]
[./node_modules/material-ui/svg-icons/content/add.js] ./~/material-ui/svg-icons/content/add.js 798 bytes {0} {1} [built]
+ 12 hidden modules
chunk {2} 2.55301891ac7083a277d9.js, 2.55301891ac7083a277d9.js.map 41.2 kB {4} [rendered]
[./client/pages/NewEvent/index.js] ./client/pages/NewEvent/index.js 18.8 kB {2} [built]
[./client/pages/NewEvent/new-event.css] ./client/pages/NewEvent/new-event.css 1.3 kB {2} [built]
[./client/styles/no-css-modules/react-input-range.css] ./client/styles/no-css-modules/react-input-range.css 1.08 kB {2} [built]
[./client/util/dates.utils.js] ./client/util/dates.utils.js 4.12 kB {0} {2} [built]
[./client/util/time-format.js] ./client/util/time-format.js 2.49 kB {2} [built]
[./node_modules/css-loader/index.js!./client/styles/no-css-modules/react-input-range.css] ./~/css-loader!./client/styles/no-css-modules/react-input-range.css 2.09 kB {2} [built]
[./node_modules/css-loader/index.js?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]!./client/pages/NewEvent/new-event.css] ./~/css-loader?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]!./client/pages/NewEvent/new-event.css 10.5 kB {2} [built]
[./node_modules/material-ui/svg-icons/action/delete.js] ./~/material-ui/svg-icons/action/delete.js 856 bytes {0} {1} {2} [built]
chunk {3} 3.55301891ac7083a277d9.js, 3.55301891ac7083a277d9.js.map 4.97 kB {4} [rendered]
[./client/components/Login/loginController.js] ./client/components/Login/loginController.js 4.97 kB {3} [built]
chunk {4} bundle.55301891ac7083a277d9.js, vendor.css, bundle.55301891ac7083a277d9.js.map, vendor.css.map (bundle) 512 kB {5} [initial] [rendered]
[./client/main.js] ./client/main.js 2.98 kB {4} [built]
[./client/router.js] ./client/router.js 3.32 kB {4} [built]
[./client/styles/no-css-modules/nprogress.css] ./client/styles/no-css-modules/nprogress.css 41 bytes {4} [built]
[./client/styles/no-css-modules/react-notifications.css] ./client/styles/no-css-modules/react-notifications.css 41 bytes {4} [built]
[./node_modules/offline-plugin/runtime.js] ./~/offline-plugin/runtime.js 379 bytes {4} [built]
[./node_modules/querystring-es3/index.js] ./~/querystring-es3/index.js 127 bytes {4} [built]
[./node_modules/react-hot-loader/index.js] ./~/react-hot-loader/index.js 41 bytes {4} [built]
[./node_modules/react-hot-loader/lib/index.js] ./~/react-hot-loader/lib/index.js 209 bytes {4} [built]
[./node_modules/react-hot-loader/lib/patch.js] ./~/react-hot-loader/lib/patch.js 209 bytes {4} [built]
[./node_modules/react-hot-loader/patch.js] ./~/react-hot-loader/patch.js 41 bytes {4} [built]
[./node_modules/strip-ansi/index.js] ./~/strip-ansi/index.js 161 bytes {4} [built]
[./node_modules/webpack-hot-middleware/client-overlay.js] (webpack)-hot-middleware/client-overlay.js 1.82 kB {4} [built]
[./node_modules/webpack-hot-middleware/client.js?reload=true] (webpack)-hot-middleware/client.js?reload=true 6.68 kB {4} [built]
[./node_modules/webpack-hot-middleware/process-update.js] (webpack)-hot-middleware/process-update.js 3.88 kB {4} [built]
[2] multi react-hot-loader/patch webpack-hot-middleware/client?reload=true ./client/main.js 52 bytes {4} [built]
+ 111 hidden modules
chunk {5} vendor.55301891ac7083a277d9.js, vendor.55301891ac7083a277d9.js.map (vendor) 4.2 MB [entry] [rendered]
[./node_modules/bluebird/js/browser/bluebird.js] ./~/bluebird/js/browser/bluebird.js 179 kB {5} [built]
[./node_modules/chroma-js/chroma.js] ./~/chroma-js/chroma.js 76.5 kB {5} [built]
[./node_modules/clipboard/lib/clipboard.js] ./~/clipboard/lib/clipboard.js 7.45 kB {5} [built]
[./node_modules/es6-promise/dist/es6-promise.js] ./~/es6-promise/dist/es6-promise.js 28.6 kB {5} [built]
[./node_modules/fast-json-patch/src/json-patch-duplex.js] ./~/fast-json-patch/src/json-patch-duplex.js 35.7 kB {5} [built]
[./node_modules/immutable/dist/immutable.js] ./~/immutable/dist/immutable.js 142 kB {5} [built]
[./node_modules/isomorphic-fetch/fetch-npm-browserify.js] ./~/isomorphic-fetch/fetch-npm-browserify.js 233 bytes {5} [built]
[./node_modules/react-infinite/build/react-infinite.js] ./~/react-infinite/build/react-infinite.js 16.6 kB {5} [built]
[./node_modules/react-input-range/lib/js/index.js] ./~/react-input-range/lib/js/index.js 1.27 kB {5} [built]
[./node_modules/react-masonry-component/lib/index.js] ./~/react-masonry-component/lib/index.js 8.49 kB {5} [built]
[./node_modules/react-notification-system/dist/NotificationSystem.js] ./~/react-notification-system/dist/NotificationSystem.js 7.6 kB {5} [built]
[1] multi autobind-decorator bluebird clipboard chroma-js es6-promise fast-json-patch immutable isomorphic-fetch jstimezonedetect lodash material-ui moment moment-range nprogress react react-addons-update react-day-picker react-tap-event-plugin react-dom react-css-modules react-infinite react-input-range react-masonry-component react-notification-system react-router 316 bytes {5} [built]
[./node_modules/react-router/es/index.js] ./~/react-router/es/index.js 1.46 kB {5} [built]
[./node_modules/react-tap-event-plugin/src/injectTapEventPlugin.js] ./~/react-tap-event-plugin/src/injectTapEventPlugin.js 1.04 kB {5} [built]
[./node_modules/react/react.js] ./~/react/react.js 56 bytes {5} [built]
+ 974 hidden modules
ERROR in ./client/assets/dashboard-banner.png
Module build failed: Error: /home/zach/Documents/Code/meeting-for-good/node_modules/pngquant-bin/vendor/pngquant: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory
at Promise.all.then.arr (/home/zach/Documents/Code/meeting-for-good/node_modules/execa/index.js:201:11)
at propagateObWrapper (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/async-hooks.js:453:25)
at instrumented (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/index.js:102:27)
at /home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/async-hooks.js:490:70
at instrumented (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/index.js:102:27)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:208:7)
at process.fallback (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/async-hooks.js:514:17)
@ ./client/pages/home/index.js 69:23-67
@ ./client/router.js
@ ./client/main.js
@ multi react-hot-loader/patch webpack-hot-middleware/client?reload=true ./client/main.js
ERROR in ./client/assets/main-banner.png
Module build failed: Error: /home/zach/Documents/Code/meeting-for-good/node_modules/pngquant-bin/vendor/pngquant: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory
at Promise.all.then.arr (/home/zach/Documents/Code/meeting-for-good/node_modules/execa/index.js:201:11)
at propagateObWrapper (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/async-hooks.js:453:25)
at instrumented (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/index.js:102:27)
at /home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/async-hooks.js:490:70
at instrumented (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/index.js:102:27)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:208:7)
at process.fallback (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/async-hooks.js:514:17)
@ ./client/pages/home/index.js 73:18-57
@ ./client/router.js
@ ./client/main.js
@ multi react-hot-loader/patch webpack-hot-middleware/client?reload=true ./client/main.js
ERROR in ./client/assets/timezones.png
Module build failed: Error: /home/zach/Documents/Code/meeting-for-good/node_modules/pngquant-bin/vendor/pngquant: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory
at Promise.all.then.arr (/home/zach/Documents/Code/meeting-for-good/node_modules/execa/index.js:201:11)
at propagateObWrapper (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/async-hooks.js:453:25)
at instrumented (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/index.js:102:27)
at /home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/async-hooks.js:490:70
at instrumented (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/index.js:102:27)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:208:7)
at process.fallback (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/async-hooks.js:514:17)
@ ./client/pages/home/index.js 81:17-54
@ ./client/router.js
@ ./client/main.js
@ multi react-hot-loader/patch webpack-hot-middleware/client?reload=true ./client/main.js
ERROR in ./client/assets/dashboard-banner-2.png
Module build failed: Error: /home/zach/Documents/Code/meeting-for-good/node_modules/pngquant-bin/vendor/pngquant: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory
at Promise.all.then.arr (/home/zach/Documents/Code/meeting-for-good/node_modules/execa/index.js:201:11)
at propagateObWrapper (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/async-hooks.js:453:25)
at instrumented (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/index.js:102:27)
at /home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/async-hooks.js:490:70
at instrumented (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/index.js:102:27)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:208:7)
at process.fallback (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/async-hooks.js:514:17)
@ ./client/pages/home/index.js 85:24-70
@ ./client/router.js
@ ./client/main.js
@ multi react-hot-loader/patch webpack-hot-middleware/client?reload=true ./client/main.js
ERROR in ./client/assets/google.png
Module build failed: Error: /home/zach/Documents/Code/meeting-for-good/node_modules/pngquant-bin/vendor/pngquant: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory
at Promise.all.then.arr (/home/zach/Documents/Code/meeting-for-good/node_modules/execa/index.js:201:11)
at propagateObWrapper (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/async-hooks.js:453:25)
at instrumented (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/index.js:102:27)
at /home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/async-hooks.js:490:70
at instrumented (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/index.js:102:27)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:208:7)
at process.fallback (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/async-hooks.js:514:17)
@ ./client/components/Login/Login.js 61:14-48
@ ./client/components/App.js
@ ./client/router.js
@ ./client/main.js
@ multi react-hot-loader/patch webpack-hot-middleware/client?reload=true ./client/main.js
ERROR in ./client/assets/Profile_avatar_placeholder_large.png
Module build failed: Error: /home/zach/Documents/Code/meeting-for-good/node_modules/pngquant-bin/vendor/pngquant: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory
at Promise.all.then.arr (/home/zach/Documents/Code/meeting-for-good/node_modules/execa/index.js:201:11)
at propagateObWrapper (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/async-hooks.js:453:25)
at instrumented (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/index.js:102:27)
at /home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/async-hooks.js:490:70
at instrumented (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/index.js:102:27)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:208:7)
at process.fallback (/home/zach/Documents/Code/meeting-for-good/node_modules/opbeat/lib/instrumentation/async-hooks.js:514:17)
@ ./client/components/NavBar/NavBar.js 65:40-100
@ ./client/components/App.js
@ ./client/router.js
@ ./client/main.js
@ multi react-hot-loader/patch webpack-hot-middleware/client?reload=true ./client/main.js
Child html-webpack-plugin for "../index.html":
Asset Size Chunks Chunk Names
../index.html 30.2 kB 0
chunk {0} ../index.html 4.56 kB [entry] [rendered]
[./node_modules/html-loader/index.js!./client/index.html] ./~/html-loader!./client/index.html 4.56 kB {0} [built]
Child favicons-webpack-plugin for "iconstats-[hash].json":
Asset Size Chunks Chunk Names
iconstats-45dbfeb4fc45f31ac12c.json 3.96 kB 0
chunk {0} iconstats-45dbfeb4fc45f31ac12c.json 3.98 kB [entry] [rendered]
[./node_modules/favicons-webpack-plugin/lib/favicons.js?{"outputFilePrefix":"icons-[hash]/","icons":{"android":true,"appleIcon":true,"appleStartup":false,"coast":false,"favicons":true,"firefox":true,"opengraph":false,"twitter":false,"yandex":false,"windows":false},"background":"transparent","persistentCache":true,"appName":"meeting-for-good"}!./client/assets/favicons/logo.png] ./~/favicons-webpack-plugin/lib/favicons.js?{"outputFilePrefix":"icons-[hash]/","icons":{"android":true,"appleIcon":true,"appleStartup":false,"coast":false,"favicons":true,"firefox":true,"opengraph":false,"twitter":false,"yandex":false,"windows":false},"background":"transparent","persistentCache":true,"appName":"meeting-for-good"}!./client/assets/favicons/logo.png 3.98 kB {0} [built]
Child extract-text-webpack-plugin:
chunk {0} extract-text-webpack-plugin-output-filename 3.98 kB [entry] [rendered]
[./node_modules/css-loader/index.js!./client/styles/no-css-modules/nprogress.css] ./~/css-loader!./client/styles/no-css-modules/nprogress.css 1.72 kB {0} [built]
[./node_modules/css-loader/lib/css-base.js] ./~/css-loader/lib/css-base.js 2.26 kB {0} [built]
Child extract-text-webpack-plugin:
chunk {0} extract-text-webpack-plugin-output-filename 2.6 kB [entry] [rendered]
[./node_modules/css-loader/index.js!./client/styles/no-css-modules/react-notifications.css] ./~/css-loader!./client/styles/no-css-modules/react-notifications.css 336 bytes {0} [built]
[./node_modules/css-loader/lib/css-base.js] ./~/css-loader/lib/css-base.js 2.26 kB {0} [built]
webpack: Failed to compile.
hey @ZaynMalloc Zach zach@zach-VirtualBox:~/Documents/Code/meeting-for-good$ npm run dev <--- its npm run serve
Congratulations for your fist merge with us! Good Work! So lets continue ? Can you create the CRUD tests for events and users ? @ZaynMalloc
Ok, I'll continue
Any help that you need please contact me ! @ZaynMalloc
I'm having some problems. I am writing tests for the /api/user endpoint. I keep on getting 403 errors. How do I bypass authentication for testing?
import chai from 'chai';
import chaiHttp from 'chai-http';
import server from '../server/app';
import User from '../server/api/user/user.model';
const should = chai.should();
chai.use(chaiHttp);
describe('Test user API', () => {
//Insert a User Into the database
beforeEach((done) => {
const newUser = new User({
googleId: 'googletest@email',
facebookId: 'facebooktest@email',
emails: ['[email protected]', 'email2@email'],
name: 'name',
avatar: 'avatar',
accessToken: '12345',
});
newUser.save(() => {
done();
});
});
afterEach((done) => {
User.collection.drop();
done();
});
it('should get a status of 200. Testing GET /api/user', (done) => {
chai.request(server)
.get('/api/user')
.end((err, res) => {
//I'm getting a 403 error
res.should.have.status(200);
done();
});
});
it('should get a status of 200. Testing POST /api/user', (done) => {
chai.request(server)
.post('/api/user')
.send({
googleId: 'googletest@email',
facebookId: 'facebooktest@email',
emails: ['[email protected]', 'email2@email'],
name: 'name',
avatar: 'avatar',
accessToken: '12345',
})
.end((err, res) => {
//I'm getting a 403 error
res.should.have.status(200);
done();
});
});
});
@ZaynMalloc thats a good question... And a complex answer... What happens is the desired behavior since express uses passport as midleware. So what we need to do is a step back and made a little more work at setup.
Fist we need to set the NODE_ENV at the .env file as 'TEST'
With the variable we can go to the IsAuth method at the /server/api/utils/api.utils.js and change the code
const isAuth = (req, res, next) => { if (req.isAuthenticated()) return next(); return res.status(403).send('Authentiation required.'); };
TO:
const isAuth = (req, res, next) => { if(process.env.NODE_ENV === 'TEST').return.next(); if (req.isAuthenticated()) return next(); return res.status(403).send('Authentiation required.'); };
Thats I suppose will work.
But because is a kind of new question to me to, can you propose this as a apart PR ? And i will test here ?
Again tks for the hard work !
on time @ZaynMalloc
afterEach((done) => { User.collection.drop(); done(); });
I think its not a good ideia drop the collection... Since we want to be able to test this at against a production db.
@ZaynMalloc news? Can I help some way?
Tks for your PR! @ZaynMalloc. Can we continue? Best!
Yes, I will continue.
I am trying to add fixtures to seed data for testing. I am using the pow-mongodb-fixtures module (https://www.npmjs.com/package/pow-mongoose-fixtures). However, I get this error:
TypeError: Undefined type `undefined` at `calendarId.required`
Did you try nesting Schemas? You can only nest using refs or arrays.
fixture.js
export default {
users: [
{
googleId: 'googletest@email',
facebookId: 'facebooktest@email',
emails: ['[email protected]', 'email2@email'],
name: 'name',
avatar: 'avatar',
accessToken: '12345',
refreshToken: '54321',
enablePrimaryCalendar: true,
GoogleSelectedCalendars://What do I do here?
}
]
}
Schema: user.model.js:
import mongoose from 'mongoose';
const Schema = mongoose.Schema;
const GoogleSelectedCalendarsSchema = new Schema(
{ calendarId: { form: String, required: true, unique: true } });
const UserSchema = new Schema({
googleId: { type: String, required: false, unique: true },
facebookId: { type: String, required: false },
emails: Array,
name: { type: String, required: true },
avatar: { type: String, required: false },
accessToken: { type: String, required: false },
refreshToken: { type: String, required: false },
enablePrimaryCalendar: { type: Boolean, required: true, default: true },
GoogleSelectedCalendars: [GoogleSelectedCalendarsSchema],
});
export default mongoose.model('User', UserSchema);
Basically, my problem is that I do not know how to insert data in the GoogleSelectedCalendars since the GoogleSelectedCalendars field has a nested schema.
I was trying to test the model by the way.
import chai from 'chai';
import chaiHttp from 'chai-http';
import chaiJSONSchema from 'chai-json-schema';
import mongoose from 'mongoose'
import fixtures from './fixtures'
import {app, server} from '../server/app';
const expect = chai.expect;
import User from '../server/api/user/user.model';
// "Only" runs one block of tests
describe.only('User model', () => {
let user = null
beforeEach(() => {
user = Object.assign({}, fixtures.users[0])
})
afterEach((done) => {
User.remove({})
.then(() => {
done()
}, () => {
console.log('Error while cleaning DB from users')
done()
})
})
describe('Success cases', () => {
it('should successfully add user', (done) => {
User.insertMany([user]).then((result) => {
console.log("Result",result[0])
const savedUser = result[0].toJSON()
expect(Object.keys(savedUser).length).to.equal(11)
expect(savedUser.name).to.equal(user.name)
expect(savedUser.email).to.equal(user.email)
expect(savedUser.avatar).to.equal(user.avatar)
// And all the other expectations
done();
}, (err) => {
console.log("Error ",err)
expect(true).to.equal(false)
done();
})
})
})
})
this field is array of this o bject { calendarId: { form: String, required: true, unique: true } } so GoogleSelectedCalendars : [{calendarId: 'anyname'}, {calendarId: 'anyname2'}] @ZaynMalloc
I changed fixture.js
export default {
users: [
{
googleId: 'googletest@email',
facebookId: 'facebooktest@email',
emails: ['[email protected]', 'email2@email'],
name: 'name',
avatar: 'avatar',
accessToken: '12345',
refreshToken: '54321',
enablePrimaryCalendar: true,
GoogleSelectedCalendars: [{ calendarId: 'anyname' }, { calendarId: 'anyname2' }],
},
],
};
However, I keep on still getting the same error.
TypeError: Undefined type `undefined` at `calendarId.required`
Did you try nesting Schemas? You can only nest using refs or arrays.
I think I need to compile a model for GoogleSelectedCalendarsSchema to export as GoogleSelectedCalendar, create a fixture for the GoogleSelectedCalendar model and then insert data for GoogleSelectedCalendars field in User, but I am do not know how to.
@ZaynMalloc I doesn't have a profound knowledge of tests behavior but give me a few days to make some research and I back to you!
thanks
@ZaynMalloc what about take another direction using https://facebook.github.io/jest/ ?
Thanks, I'll look into that
@ZaynMalloc the big deal about jest is the ability to test state. so we can emulate the screen behavior and make a better UX! So im using that at my professional side now!
I'm having trouble with jest. I get the error.
SyntaxError: Unexpected token .
at ScriptTransformer._transformAndBuildScript (node_modules/jest/node_modules/jest-cli/node_modules/jest-runtime/build/ScriptTransformer.js:289:17)
at Object.<anonymous> (client/components/AboutDialog/AboutDialog.js:7:20)
at Object.<anonymous> (__tests__/test.js:2:20)
My test which are in the _tests_ folder
import React from 'react';
import AboutComponent from '../client/components/AboutDialog/AboutDialog';
import { shallow } from 'enzyme';
describe('Test', () => {
it('It should open and close modal', () => {
});
});
.babelrc file
{
"presets": ["react", "es2015", "stage-1"],
"plugins": [
"transform-decorators-legacy",
"react-hot-loader/babel",
["transform-runtime", { "polyfill": false, "regenerator": true }]
],
"env": {
"development": {
"presets": [
"react-hmre"
]
}
}
}
{
"name": "meeting-for-good",
"version": "1.0.12",
"description": "Schedule events with ease!",
"homepage": "https://github.com/FreeCodeCamp/meeting-for-good/#readme",
"main": "index.js",
"scripts": {
"clean": "rimraf build",
"build:server": "babel -d ./build ./server -s",
"build:client": "cross-env NODE_ENV=production babel-node ./tools/build.js",
"build": "npm run clean && npm run copy && npm run build:server && npm run build:client",
"start": " node ./build/app.js",
"copy": "node tools/copy.js",
"serve": "npm run clean && npm run copy && npm run build:server && npm run dev",
"dev": "cross-env NODE_ENV=development node -r dotenv/config ./build/app.js",
"test": "cross-env NODE_ENV=test jest",
"heroku-postbuild": "npm run build",
"postinstall": "node tools/postInstall.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/FreeCodeCamp/meeting-for-good"
},
"author": "Jean Philip de Rogatis <[email protected]>",
"contributors": [
{
"name": "Aniruddh Agarwal",
"email": "[email protected]"
},
{
"name": "Bob Sutton",
"email": "[email protected]"
}
],
"license": "MIT",
"bugs": {
"url": "https://github.com/FreeCodeCamp/meeting-for-good/issues"
},
"engines": {
"node": "^8.0.0",
"npm": "^5.0.0"
},
"dependencies": {
"autobind-decorator": "^2.1.0",
"babel-cli": "^6.22.2",
"babel-core": "^6.22.1",
"babel-eslint": "^7.2.1",
"babel-loader": "^7.1.1",
"babel-plugin-react-transform": "^2.0.2",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-es2015": "^6.22.0",
"babel-preset-react": "^6.22.0",
"babel-preset-react-hmre": "^1.1.1",
"babel-preset-stage-1": "^6.22.0",
"babel-runtime": "^6.25.0",
"bluebird": "^3.5.0",
"body-parser": "^1.17.2",
"chai": "^4.1.0",
"chalk": "^2.0.1",
"chroma-js": "^1.3.3",
"chunk-manifest-webpack2-plugin": "^1.0.1",
"clipboard": "^1.6.1",
"compression": "^1.7.0",
"connect-flash": "^0.1.1",
"connect-mongo": "^1.3.2",
"cookie-parser": "^1.4.3",
"copy-webpack-plugin": "^4.0.1",
"cpy-cli": "^1.0.1",
"cross-env": "^5.0.1",
"css-loader": "^0.28.1",
"cssnano": "^3.10.0",
"dialog-polyfill": "^0.4.6",
"dotenv": "^4.0.0",
"ejs": "^2.5.5",
"email-templates": "^2.5.6",
"es6-promise": "^4.1.1",
"express": "^4.15.3",
"express-session": "^1.15.4",
"express-sessions": "^1.0.6",
"extract-text-webpack-plugin": "^2.1.0",
"fast-json-patch": "^2.0.4",
"favicons-webpack-plugin": "0.0.7",
"file-loader": "^0.11.1",
"google-calendar": "^1.3.2",
"html-loader": "^0.4.4",
"html-webpack-plugin": "^2.29.0",
"image-webpack-loader": "^3.3.1",
"immutable": "^3.8.1",
"isomorphic-fetch": "^2.2.1",
"jstimezonedetect": "^1.0.6",
"lodash": "^4.17.2",
"material-ui": "^0.18.5",
"mocha": "^3.4.2",
"moment": "^2.18.1",
"moment-range": "^3.0.3",
"mongoose": "^4.11.3",
"morgan": "^1.8.2",
"nodemailer": "^4.0.1",
"nodemailer-ses-transport": "^1.5.0",
"nprogress": "^0.2.0",
"offline-plugin": "^4.8.3",
"opbeat": "^4.14.2",
"optimize-css-assets-webpack-plugin": "^2.0.0",
"passport": "^0.3.2",
"passport-facebook": "^2.1.1",
"passport-google-oauth": "^1.0.0",
"passport-oauth2-refresh": "^1.0.0",
"pngquant-bin": "^3.1.1",
"prop-types": "^15.5.10",
"react": "^15.6.0",
"react-addons-update": "^15.5.2",
"react-css-modules": "^4.3.0",
"react-day-picker": "^5.5.1",
"react-dom": "^15.6.0",
"react-ga": "^2.2.0",
"react-hot-loader": "^3.0.0-beta.7",
"react-infinite": "^0.11.0",
"react-input-range": "^1.2.1",
"react-masonry-component": "^5.0.3",
"react-moment-proptypes": "^1.4.0",
"react-notification-system": "^0.2.14",
"react-router": "^3.0.2",
"react-tap-event-plugin": "^2.0.1",
"react-tooltip": "^3.3.0",
"react-transform-hmr": "^1.0.4",
"request": "^2.81.0",
"rimraf": "^2.6.1",
"shelljs": "^0.7.7",
"style-loader": "^0.18.1",
"url-loader": "^0.5.7",
"webpack": "^2.7.0",
"webpack-assets-manifest": "^0.7.0",
"webpack-bundle-analyzer": "^2.8.3",
"webpack-config": "^7.0.0",
"write-file-webpack-plugin": "^4.0.0",
"yargs": "^8.0.1"
},
"devDependencies": {
"babel-jest": "^20.0.3",
"babel-preset-jest": "^20.0.3",
"enzyme": "^2.9.1",
"eslint": "^3.19.0",
"eslint-config-airbnb": "^15.0.0",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.8.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^5.1.0",
"eslint-plugin-react": "^7.0.1",
"jest": "^20.0.4",
"jest-css-modules": "^1.1.0",
"react-dom": "^15.6.1",
"react-test-renderer": "^15.6.1",
"regenerator-runtime": "^0.10.5",
"webpack-dev-middleware": "^1.11.0",
"webpack-dev-server": "^2.5.1",
"webpack-hot-middleware": "^2.18.2"
},
"jest": {
"transform": {
".*": "<rootDir>/node_modules/babel-jest"
}
}
}
I will back for you ASAP @ZaynMalloc
@jrogatis Thanks!
@jrogatis I solved it
Cool @ZaynMalloc !!!