File tree 2 files changed +47
-0
lines changed
2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ var EE = require ( 'events' ) . EventEmitter ;
2
+ var turbasen = require ( '../' ) ;
3
+
4
+ module . exports = new EE ( ) ;
5
+
6
+ var query = {
7
+ grupper : '!' ,
8
+ fields : 'privat' ,
9
+ 'privat.opprettet_av.epost' : '~kommune' ,
10
+ } ;
11
+
12
+ turbasen . turer . each ( query , function each ( tur , next ) {
13
+ module . exports . emit ( 'data' , tur ) ;
14
+
15
+ if ( ! module . parent ) {
16
+ var url = `http://www.ut.no/tur/${ tur . _id } ` ;
17
+
18
+ if ( tur . privat . opprettet_av && tur . privat . opprettet_av . epost ) {
19
+ console . log ( url , tur . privat . opprettet_av . epost ) ;
20
+ }
21
+
22
+ if ( tur . privat . endret_av && tur . privat . endret_av . epost
23
+ && tur . privat . endret_av . epost !== tur . privat . opprettet_av . epost
24
+ ) {
25
+ console . log ( url , tur . privat . endret_av . epost ) ;
26
+ }
27
+ }
28
+
29
+ process . nextTick ( next ) ;
30
+ } , function done ( err ) {
31
+ module . exports . emit ( 'done' , err ) ;
32
+ } ) ;
Original file line number Diff line number Diff line change @@ -123,12 +123,27 @@ describe('grupper-cache.js', function describe() {
123
123
124
124
describe ( 'turer-title-with-year.js' , function describe ( ) {
125
125
it ( 'returns trips with year in the title' , function it ( done ) {
126
+ this . timeout ( 15000 ) ;
127
+
126
128
require ( './examples/turer-title-with-year' ) . on ( 'data' , data => {
127
129
assert ( / 2 0 1 [ 0 - 9 ] / . test ( data . navn ) ) ;
128
130
} ) . on ( 'done' , done ) ;
129
131
} ) ;
130
132
} ) ;
131
133
134
+ describe ( 'municipality-users.js' , function describe ( ) {
135
+ it ( 'returns trips created by municipality users' , function it ( done ) {
136
+ this . timeout ( 15000 ) ;
137
+
138
+ require ( './examples/municipality-users' ) . on ( 'data' , tur => {
139
+ assert (
140
+ / k o m m u n e / . test ( tur . privat . opprettet_av . epost ) ||
141
+ / k o m m u n e / . test ( tur . privat . endret_av . epost )
142
+ ) ;
143
+ } ) . on ( 'done' , done ) ;
144
+ } ) ;
145
+ } ) ;
146
+
132
147
describe ( 'util.attribution()' , function describe ( ) {
133
148
let type ;
134
149
let doc ;
You can’t perform that action at this time.
0 commit comments