File tree Expand file tree Collapse file tree 2 files changed +60
-8
lines changed
Expand file tree Collapse file tree 2 files changed +60
-8
lines changed Original file line number Diff line number Diff line change 11language : node_js
2- node_js :
3- - " stable"
4- os :
5- osx
6- # jobs:
7- # allow_failures:
8- # - os: osx
2+ node_js :
3+ - ' stable'
4+ os : osx
5+ git :
6+ quiet : true
7+ jobs :
8+ allow_failures :
9+ - os : osx
10+ fast_finish : true
911install :
10- - npm install
12+ - npm install
13+ script :
14+ npm test:app
15+ # safelist
16+ # branches:
17+ # only:
18+ # - master
19+ # - middleware
20+ # - chronosWebsite
Original file line number Diff line number Diff line change 1+ var expect = require ( 'chai' ) . expect ;
2+ var MongoClient = require ( 'mongodb' ) . MongoClient ;
3+
4+ describe ( 'middleware' , ( ) => {
5+ var healthInfo , db ;
6+
7+ beforeAll ( function ( done ) {
8+ MongoClient . connect (
9+ 'mongodb+srv://numanzor:[email protected] /chronos-access' , { useNewUrlParser :
true } , function ( err , client ) { 10+ if ( err ) throw new Error ( err ) ;
11+ done ( ) ;
12+ db = client . db ( 'chronos-access' ) ;
13+ healthInfo = db . collection ( 'healthinfos' ) ;
14+ }
15+ ) ;
16+ } ) ;
17+
18+ test ( 'should have records in the "healthinfos" collection' , done => {
19+ healthInfo . countDocuments ( function ( err , num ) {
20+ expect ( err ) . to . not . exist ;
21+ expect ( num ) . to . be . above ( 0 ) ;
22+ done ( ) ;
23+ } ) ;
24+ } ) ;
25+
26+ test ( 'should have the right string and date-time fields' , done => {
27+ healthInfo . find ( ) . toArray ( function ( err , data ) {
28+ expect ( err ) . to . not . exist ;
29+ expect ( data ) . to . be . an ( 'Array' ) ;
30+ var dataPoint = data [ 0 ] ;
31+ expect ( dataPoint . currentMicroservice ) . to . be . a ( 'string' ) . and . not . eql ( '' ) ;
32+ expect ( dataPoint . targetedEndpoint ) . to . be . a ( 'string' ) . and . not . eql ( '' ) ;
33+ expect ( dataPoint . reqType ) . to . be . a ( 'string' ) . and . not . eql ( '' ) ;
34+ expect ( dataPoint . timeSent ) . to . be . a ( 'date' ) . and . not . eql ( '' ) ;
35+ done ( ) ;
36+ } ) ;
37+ } ) ;
38+
39+ afterAll ( function ( ) {
40+ db . close ( ) ;
41+ } ) ;
42+ } ) ;
You can’t perform that action at this time.
0 commit comments