Advertisement
lemb

Untitled

Jan 11th, 2017
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.30 KB | None | 0 0
  1. Running "test" task
  2. (node:19744) DeprecationWarning: sys is deprecated. Use util instead.
  3.  
  4. Running "env:test" (env) task
  5.  
  6. Running "eslint:all" (eslint) task
  7.  
  8. Running "jsonlint:all" (jsonlint) task
  9. >> 63 files lint free.
  10.  
  11. Running "mochacli:server" (mochacli) task
  12. Adding Array.prototype.tap for tests
  13. Stubbing agenda
  14. Swagger: skipping unknown type "GeoJSON.Point".
  15. Swagger: skipping unknown type "GeoJSON.Polygon".
  16. Stubbing Email
  17.  
  18.  
  19. Agenda ready
  20. Swagger: skipping unknown type "GeoJSON.Point".
  21. Swagger: skipping unknown type "GeoJSON.Polygon".
  22. Forms mounted: 1 success, 0 failures
  23. Boot sequence completed
  24. Event
  25. API
  26. Wed, 11 Jan 2017 13:05:16 GMT loopback deprecated loopback#context middleware is deprecated. See https://docs.strongloop.com/display/APIC/Using%20current%20context for more details. at node_modules/loopback/server/middleware/rest.js:60:32
  27. ✓ PUT / should 404 (116ms)
  28. ✓ GET / should 404
  29. ✓ GET /findOne should 404
  30. ✓ GET /count should 404
  31. ✓ POST /update should 404
  32. ✓ GET /:id should 404
  33. ✓ DELETE /:id should 404
  34. ✓ PUT /:id should 404
  35. ✓ GET /:id/exists should 404
  36. ✓ POST /change-stream should 404
  37. POST
  38. ✓ should not crash on invalid coordinates (49ms)
  39. ✓ should return an object `{id:""}` (48ms)
  40. "gps" event
  41. ✓ should create an event
  42. "beacon-scan" event
  43. ✓ should create an event
  44. ✓ should have updated the devices
  45. ✓ OLD >> should have updated the devices
  46. two scanner reporting SOS
  47. accessToken >> { ttl: 1209600,
  48. created: 2017-01-11T13:05:16.592Z,
  49. userId: 58762d8c7ab1723e4df20a9b,
  50. resourceId: '_58762d8c7ab1723e4df20a9c',
  51. organizationId: 'primary',
  52. id: '12457375429839' }
  53. Alert created without a scanner. macAddress: AAAAAAAA0123
  54. accessToken >> { ttl: 1209600,
  55. created: 2017-01-11T13:05:16.592Z,
  56. userId: 58762d8c7ab1723e4df20a9b,
  57. resourceId: '_58762d8c7ab1723e4df20a9c',
  58. organizationId: 'primary',
  59. id: '12457375429839' }
  60. ✓ should only create a single alert (1191ms)
  61.  
  62. Event
  63. model (alerts)
  64. validation
  65. #beacons
  66. ✓ should contain a single item
  67. #isAlert
  68. ✓ should be true for "alert.cancel","alert.confirm","alert.resolve"
  69. #applyAlert
  70. ✓ should fail when the event is not an "alert.*" event
  71. ✓ should update the beacons present in the event (along with their resource) (44ms)
  72. ✓ should update the most recent alert coinciding with the timestamp and update status (76ms)
  73. ✓ should create an ActivityLog for the action (75ms)
  74.  
  75. Event
  76. model
  77. #applyBeaconScan
  78. ✓ should fail when the event is not a "beacon-scan" event
  79. ✓ should update the beacons present in the event (along with their resource) (68ms)
  80. ✓ should not update devices that belong to other organization (61ms)
  81. - AGENDA TESTING: should ignore unprovisionned macAddress
  82. ✓ should update the scanner's location (along with its resource's)
  83. ✓ should NOT update scanner location if coordinates are missing
  84. accessToken >> { userId: 58762d8c7ab1723e4df20a98,
  85. organizationId: 'event_testing',
  86. created: 2017-01-11T13:05:16.075Z,
  87. ttl: 1209600 }
  88. Alert created without a scanner. macAddress: 012345678911
  89. ✓ should create an alert for SOS message types (76ms)
  90. #createAlert
  91. ✓ should return an Alert for SOS message types (50ms)
  92. - [DELAYED] should return an for MANDOWN message types
  93. ✓ should throw an error if no message is found for the macAddress
  94. ✓ should throw an error on MANDOWN
  95. ✓ should throw an error if the messageType is not an emergency
  96. #scannedBeacons
  97. #getEmergencyMessages()
  98. accessToken >> { userId: 58762d8c7ab1723e4df20a98,
  99. organizationId: 'event_testing',
  100. created: 2017-01-11T13:05:16.075Z,
  101. ttl: 1209600 }
  102. ✓ should return SOS but not MANDOWN beaconScans
  103. ✓ should be empty when there are no emergency
  104. ✓ should be empty on "gps" events
  105. #_detectAndHandleEmergencyMesssages
  106. with no prior events
  107. accessToken >> { organizationId: 'event_testing' }
  108. ✓ should create an alert
  109. but scanned by another organization
  110. accessToken >> { organizationId: 'event_testingdifferent' }
  111. ✓ should NOT create an alert
  112. with a previous event that is not an emergency
  113. accessToken >> { organizationId: 'event_testing' }
  114. ✓ should create an alert
  115. with a previous event that is the same emergency
  116. accessToken >> { userId: 58762d8c7ab1723e4df20a98,
  117. organizationId: 'event_testing',
  118. created: 2017-01-11T13:05:16.075Z,
  119. ttl: 1209600 }
  120. Alert created without a scanner. macAddress: 000000000002
  121. accessToken >> { organizationId: 'event_testing' }
  122. ✓ should NOT create an alert
  123. - TODO: should update the alert
  124. with a next event that is the same emergency
  125. accessToken >> { userId: 58762d8c7ab1723e4df20a98,
  126. organizationId: 'event_testing',
  127. created: 2017-01-11T13:05:16.075Z,
  128. ttl: 1209600 }
  129. Alert created without a scanner. macAddress: 000000000002
  130. accessToken >> { organizationId: 'event_testing' }
  131. ✓ should NOT create an alert
  132. - TODO: should update the alert
  133.  
  134. Event
  135. model
  136. validation
  137. #event
  138. ✓ should be required
  139. enum values
  140. ✓ gps
  141. ✓ beacon-scan
  142. ✓ alert.cancel
  143. ✓ alert.confirm
  144. ✓ alert.resolve
  145. ✓ should not validate other values
  146. #installationId
  147. ✓ should be required
  148. #coordinates
  149. ✓ should accept array coordinates and convert to point
  150. ✓ should be required for "gps" events
  151. ✓ should not be required for "beacon-scan" events
  152. #beacons
  153. ✓ should not be validated when empty
  154. [WHEN NEEDED] #scheduleApplication
  155. - should schedule the event processing in agenda
  156. #apply
  157. ✓ "gps" dispatches to #applyGps
  158. ✓ "beacon-scan" dispatches to #applyBeaconScan
  159. ✓ "alert.cancel" dispatches to #applyAlert
  160. ✓ "alert.confirm" dispatches to #applyAlert
  161. ✓ "alert.resolve" dispatches to #applyAlert
  162. it should implement loopback observables
  163. ✓ should have called "before application" then "apply", then "afterApplication"
  164. #applyGps
  165. ✓ should fail when the event is not a "gps" event
  166. ✓ should update the device's location referenced by `installationId` (along with its resource) (44ms)
  167.  
  168. Role Permissions
  169. $authenticated
  170. permissions
  171. /api/v2/Events
  172. ✓ Hide find GET /
  173. ✓ Allow create POST /
  174. ✓ Hide findById GET /:id
  175. ✓ Hide updateAttributes PUT /:id
  176. ✓ Hide deleteById DELETE /:id
  177. ✓ Hide exists GET /:id/exists
  178. ✓ Hide count GET /count
  179. ✓ Hide findOne GET /findOne
  180. ✓ Hide updateAll POST /update
  181. ✓ Hide upsert PUT /
  182.  
  183. Role Permissions
  184. Admin
  185. permissions
  186. /api/v2/Events
  187. ✓ Hide find GET /
  188. ✓ Allow create POST /
  189. ✓ Hide findById GET /:id
  190. ✓ Hide updateAttributes PUT /:id
  191. ✓ Hide deleteById DELETE /:id
  192. ✓ Hide exists GET /:id/exists
  193. ✓ Hide count GET /count
  194. ✓ Hide findOne GET /findOne
  195. ✓ Hide updateAll POST /update
  196. ✓ Hide upsert PUT /
  197.  
  198. Role Permissions
  199. Foreman
  200. permissions
  201. /api/v2/Events
  202. ✓ Hide find GET /
  203. ✓ Allow create POST /
  204. ✓ Hide findById GET /:id
  205. ✓ Hide updateAttributes PUT /:id
  206. ✓ Hide deleteById DELETE /:id
  207. ✓ Hide exists GET /:id/exists
  208. ✓ Hide count GET /count
  209. ✓ Hide findOne GET /findOne
  210. ✓ Hide updateAll POST /update
  211. ✓ Hide upsert PUT /
  212. Logout didnt find the token. Usually harmless Error: could not find accessToken
  213. at /home/lemb/Projects/wyzeio/node_modules/loopback/common/models/user.js:302:12
  214. at /home/lemb/Projects/wyzeio/node_modules/loopback-datasource-juggler/lib/dao.js:2011:62
  215. at /home/lemb/Projects/wyzeio/node_modules/loopback-datasource-juggler/lib/dao.js:1939:11
  216. at /home/lemb/Projects/wyzeio/node_modules/loopback-datasource-juggler/node_modules/async/lib/async.js:396:17
  217. at async.each (/home/lemb/Projects/wyzeio/node_modules/loopback-datasource-juggler/node_modules/async/lib/async.js:153:20)
  218. at _asyncMap (/home/lemb/Projects/wyzeio/node_modules/loopback-datasource-juggler/node_modules/async/lib/async.js:390:13)
  219. at Object.map (/home/lemb/Projects/wyzeio/node_modules/loopback-datasource-juggler/node_modules/async/lib/async.js:361:23)
  220. at allCb (/home/lemb/Projects/wyzeio/node_modules/loopback-datasource-juggler/lib/dao.js:1867:15)
  221. at /home/lemb/Projects/wyzeio/node_modules/loopback-connector-mongodb/lib/mongodb.js:895:9
  222. at handleCallback (/home/lemb/Projects/wyzeio/node_modules/loopback-connector-mongodb/node_modules/mongodb/lib/utils.js:96:12)
  223. at /home/lemb/Projects/wyzeio/node_modules/loopback-connector-mongodb/node_modules/mongodb/lib/cursor.js:839:16
  224. at handleCallback (/home/lemb/Projects/wyzeio/node_modules/loopback-connector-mongodb/node_modules/mongodb-core/lib/cursor.js:159:5)
  225. at setCursorNotified (/home/lemb/Projects/wyzeio/node_modules/loopback-connector-mongodb/node_modules/mongodb-core/lib/cursor.js:511:3)
  226. at /home/lemb/Projects/wyzeio/node_modules/loopback-connector-mongodb/node_modules/mongodb-core/lib/cursor.js:582:16
  227. at queryCallback (/home/lemb/Projects/wyzeio/node_modules/loopback-connector-mongodb/node_modules/mongodb-core/lib/cursor.js:220:18)
  228. at /home/lemb/Projects/wyzeio/node_modules/continuation-local-storage/context.js:84:17
  229. at bound (domain.js:280:14)
  230. at runBound (domain.js:293:12)
  231. at Callbacks.emit (/home/lemb/Projects/wyzeio/node_modules/loopback-connector-mongodb/node_modules/mongodb-core/lib/topologies/server.js:119:3)
  232. at Connection.messageHandler (/home/lemb/Projects/wyzeio/node_modules/loopback-connector-mongodb/node_modules/mongodb-core/lib/topologies/server.js:397:23)
  233. at Socket.<anonymous> (/home/lemb/Projects/wyzeio/node_modules/loopback-connector-mongodb/node_modules/mongodb-core/lib/connection/connection.js:302:22)
  234. at emitOne (events.js:96:13)
  235. at Socket.emit (events.js:188:7)
  236. at readableAddChunk (_stream_readable.js:176:18)
  237. at Socket.Readable.push (_stream_readable.js:134:10)
  238. at TCP.onread (net.js:548:20)
  239. From previous event:
  240. at Object.createPromiseCallback (/home/lemb/Projects/wyzeio/node_modules/loopback/lib/utils.js:19:17)
  241. at Function.User.logout (/home/lemb/Projects/wyzeio/node_modules/loopback/common/models/user.js:295:22)
  242. at Object.logout (/home/lemb/Projects/wyzeio/server/test/helpers/api-helpers.js:85:8)
  243. at Context.after (/home/lemb/Projects/wyzeio/server/test/spec/roles/foreman.spec.js:53:21)
  244. at callFn (/home/lemb/Projects/wyzeio/node_modules/grunt-mocha-cli/node_modules/mocha/lib/runnable.js:326:21)
  245. at Hook.Runnable.run (/home/lemb/Projects/wyzeio/node_modules/grunt-mocha-cli/node_modules/mocha/lib/runnable.js:319:7)
  246. at next (/home/lemb/Projects/wyzeio/node_modules/grunt-mocha-cli/node_modules/mocha/lib/runner.js:298:10)
  247. at /home/lemb/Projects/wyzeio/node_modules/grunt-mocha-cli/node_modules/mocha/lib/runner.js:315:7
  248. at done (/home/lemb/Projects/wyzeio/node_modules/grunt-mocha-cli/node_modules/mocha/lib/runnable.js:287:5)
  249. at /home/lemb/Projects/wyzeio/node_modules/grunt-mocha-cli/node_modules/mocha/lib/runnable.js:331:11
  250. at /home/lemb/Projects/wyzeio/node_modules/async-listener/glue.js:188:31
  251. at _combinedTickCallback (internal/process/next_tick.js:67:7)
  252. at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:122:9)
  253.  
  254. Role Permissions
  255. Project Manager
  256. permissions
  257. /api/v2/Events
  258. ✓ Hide find GET /
  259. ✓ Allow create POST /
  260. ✓ Hide findById GET /:id
  261. ✓ Hide updateAttributes PUT /:id
  262. ✓ Hide deleteById DELETE /:id
  263. ✓ Hide exists GET /:id/exists
  264. ✓ Hide count GET /count
  265. ✓ Hide findOne GET /findOne
  266. ✓ Hide updateAll POST /update
  267. ✓ Hide upsert PUT /
  268.  
  269. Role Permissions
  270. Supervisor
  271. permissions
  272. /api/v2/Events
  273. ✓ Hide find GET /
  274. ✓ Allow create POST /
  275. ✓ Hide findById GET /:id
  276. ✓ Hide updateAttributes PUT /:id
  277. ✓ Hide deleteById DELETE /:id
  278. ✓ Hide exists GET /:id/exists
  279. ✓ Hide count GET /count
  280. ✓ Hide findOne GET /findOne
  281. ✓ Hide updateAll POST /update
  282. ✓ Hide upsert PUT /
  283.  
  284.  
  285. 111 passing (5s)
  286. 5 pending
  287.  
  288.  
  289. Running "mochacli:sync" (mochacli) task
  290. Adding Array.prototype.tap for tests
  291. Stubbing agenda
  292. Stubbing Email
  293.  
  294.  
  295. Agenda ready
  296. Forms mounted: 0 success, 0 failures
  297. Boot sequence completed
  298. Created 1 FormTemplate:
  299. Created 1 Organization:
  300. app.booting false
  301. Aerial Inspection Notification
  302. Agenda processing
  303. - should debounce rapid events and run a single job for the vehicle
  304. - should run four times then delete itself
  305. when resource has been stopped less than 4 hours
  306. - should NOT be triggered
  307. when resource has been stopped for at least 4 hours
  308. - should be triggered
  309. .sendEmailToSupervisors(job)
  310. - should not fail when no admins
  311. - should send an email to all admins that haven't opted out
  312.  
  313. Job
  314. process-event
  315. validation
  316. ✓ should fail when no data.eventId is present
  317. ✓ should fail when data.eventId is the wrong format
  318. running the job
  319. on "beacon-scan"
  320. 1) "before all" hook
  321.  
  322.  
  323. 2 passing (178ms)
  324. 6 pending
  325. 1 failing
  326.  
  327. 1) Job process-event running the job on "beacon-scan" "before all" hook:
  328.  
  329. Uncaught AssertionError: accessToken is required
  330. + expected - actual
  331.  
  332. -false
  333. +true
  334.  
  335. at Console.assert (console.js:95:23)
  336. at ModelConstructor._detectAndHandleEmergencyMesssages (common/models/event.js:375:15)
  337. at onAfterSaveHandleEmergencies (common/models/event.js:156:49)
  338. at notifySingleObserver (node_modules/loopback-datasource-juggler/lib/observer.js:103:22)
  339. at iterate (node_modules/loopback-datasource-juggler/node_modules/async/lib/async.js:181:13)
  340. at Object.async.eachSeries (node_modules/loopback-datasource-juggler/node_modules/async/lib/async.js:197:9)
  341. at doNotify (node_modules/loopback-datasource-juggler/lib/observer.js:100:11)
  342. at doNotify (node_modules/loopback-datasource-juggler/lib/observer.js:98:49)
  343. at doNotify (node_modules/loopback-datasource-juggler/lib/observer.js:98:49)
  344. at doNotify (node_modules/loopback-datasource-juggler/lib/observer.js:98:49)
  345. at doNotify (node_modules/loopback-datasource-juggler/lib/observer.js:98:49)
  346. at Function.ObserverMixin._notifyBaseObservers (node_modules/loopback-datasource-juggler/lib/observer.js:121:5)
  347. at Function.ObserverMixin.notifyObserversOf (node_modules/loopback-datasource-juggler/lib/observer.js:96:8)
  348. at Function.ObserverMixin._notifyBaseObservers (node_modules/loopback-datasource-juggler/lib/observer.js:119:15)
  349. at Function.ObserverMixin.notifyObserversOf (node_modules/loopback-datasource-juggler/lib/observer.js:96:8)
  350. at Function.ObserverMixin._notifyBaseObservers (node_modules/loopback-datasource-juggler/lib/observer.js:119:15)
  351. at Function.ObserverMixin.notifyObserversOf (node_modules/loopback-datasource-juggler/lib/observer.js:96:8)
  352. at Function.ObserverMixin._notifyBaseObservers (node_modules/loopback-datasource-juggler/lib/observer.js:119:15)
  353. at Function.ObserverMixin.notifyObserversOf (node_modules/loopback-datasource-juggler/lib/observer.js:96:8)
  354. at Function.ObserverMixin._notifyBaseObservers (node_modules/loopback-datasource-juggler/lib/observer.js:119:15)
  355. at Function.ObserverMixin.notifyObserversOf (node_modules/loopback-datasource-juggler/lib/observer.js:96:8)
  356. at ModelConstructor.<anonymous> (node_modules/loopback-datasource-juggler/lib/dao.js:376:23)
  357. at ModelConstructor.next (node_modules/loopback-datasource-juggler/lib/hooks.js:81:12)
  358. at ModelConstructor.<anonymous> (node_modules/loopback-datasource-juggler/lib/dao.js:364:26)
  359. at ModelConstructor.next (node_modules/loopback-datasource-juggler/lib/hooks.js:81:12)
  360. at node_modules/loopback-datasource-juggler/lib/dao.js:363:22
  361. at doNotify (node_modules/loopback-datasource-juggler/lib/observer.js:98:49)
  362. at doNotify (node_modules/loopback-datasource-juggler/lib/observer.js:98:49)
  363. at doNotify (node_modules/loopback-datasource-juggler/lib/observer.js:98:49)
  364. at doNotify (node_modules/loopback-datasource-juggler/lib/observer.js:98:49)
  365. at doNotify (node_modules/loopback-datasource-juggler/lib/observer.js:98:49)
  366. at Function.ObserverMixin._notifyBaseObservers (node_modules/loopback-datasource-juggler/lib/observer.js:121:5)
  367. at Function.ObserverMixin.notifyObserversOf (node_modules/loopback-datasource-juggler/lib/observer.js:96:8)
  368. at Function.ObserverMixin._notifyBaseObservers (node_modules/loopback-datasource-juggler/lib/observer.js:119:15)
  369. at Function.ObserverMixin.notifyObserversOf (node_modules/loopback-datasource-juggler/lib/observer.js:96:8)
  370. at Function.ObserverMixin._notifyBaseObservers (node_modules/loopback-datasource-juggler/lib/observer.js:119:15)
  371. at Function.ObserverMixin.notifyObserversOf (node_modules/loopback-datasource-juggler/lib/observer.js:96:8)
  372. at Function.ObserverMixin._notifyBaseObservers (node_modules/loopback-datasource-juggler/lib/observer.js:119:15)
  373. at Function.ObserverMixin.notifyObserversOf (node_modules/loopback-datasource-juggler/lib/observer.js:96:8)
  374. at Function.ObserverMixin._notifyBaseObservers (node_modules/loopback-datasource-juggler/lib/observer.js:119:15)
  375. at Function.ObserverMixin.notifyObserversOf (node_modules/loopback-datasource-juggler/lib/observer.js:96:8)
  376. at createCallback (node_modules/loopback-datasource-juggler/lib/dao.js:353:17)
  377. at node_modules/loopback-connector-mongodb/lib/mongodb.js:346:7
  378. at _combinedTickCallback (internal/process/next_tick.js:67:7)
  379. at process._tickDomainCallback (internal/process/next_tick.js:122:9)
  380.  
  381.  
  382.  
  383. Warning: Use --force to continue.
  384.  
  385. Aborted due to warnings.
  386.  
  387. Process finished with exit code 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement