-
Notifications
You must be signed in to change notification settings - Fork 15
/
tests.coffee
21096 lines (20263 loc) · 582 KB
/
tests.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
WAIT_FOR_DATABASE_TIMEOUT = 2000 # ms
# The order of documents here tests delayed definitions
# Just to make sure things are sane
assert.equal Document._delayed.length, 0
assert _.isEqual Document.list, []
assert _.isEqual Document._collections, {}
globalTestTriggerCounters = {}
class Post extends Document
# Other fields:
# body
# subdocument
# body
# nested
# body
@Meta
name: 'Post'
fields: ->
# We can reference other document
author: @ReferenceField Person, ['username', 'displayName', 'field1', 'field2'], true, 'posts', ['body', 'subdocument.body', 'nested.body']
# Or an array of documents
subscribers: [@ReferenceField Person]
# Fields can be arbitrary MongoDB projections, as an array
reviewers: [@ReferenceField Person, [username: 1]]
subdocument:
# Fields can be arbitrary MongoDB projections, as an object
person: @ReferenceField Person, {'username': 1, 'displayName': 1, 'field1': 1, 'field2': 1}, false, 'subdocument.posts', ['body', 'subdocument.body', 'nested.body']
nested: [
required: @ReferenceField Person, ['username', 'displayName', 'field1', 'field2'], true, 'nestedPosts', ['body', 'subdocument.body', 'nested.body']
optional: @ReferenceField Person, ['username'], false
slug: @GeneratedField 'self', ['body', 'nested.body'], (fields) ->
for nested in fields.nested or []
if _.isUndefined(fields.body) or _.isUndefined(nested.body)
[fields._id, undefined]
else if _.isNull(fields.body) or _.isNull(nested.body)
[fields._id, null]
else
[fields._id, "nested-prefix-#{ fields.body.toLowerCase() }-#{ nested.body.toLowerCase() }-suffix"]
]
slug: @GeneratedField 'self', ['body', 'subdocument.body'], (fields) ->
if _.isUndefined(fields.body) or _.isUndefined(fields.subdocument?.body)
[fields._id, undefined]
else if _.isNull(fields.body) or _.isNull(fields.subdocument.body)
[fields._id, null]
else
[fields._id, "prefix-#{ fields.body.toLowerCase() }-#{ fields.subdocument.body.toLowerCase() }-suffix"]
generators: ->
subdocument:
slug: @GeneratedField 'self', ['body', 'subdocument.body'], (fields) ->
if _.isUndefined(fields.body) or _.isUndefined(fields.subdocument?.body)
[fields._id, undefined]
else if _.isNull(fields.body) or _.isNull(fields.subdocument.body)
[fields._id, null]
else
[fields._id, "subdocument-prefix-#{ fields.body.toLowerCase() }-#{ fields.subdocument.body.toLowerCase() }-suffix"]
tags: [
@GeneratedField 'self', ['body', 'subdocument.body', 'nested.body'], (fields) ->
tags = []
if fields.body and fields.subdocument?.body
tags.push "tag-#{ tags.length }-prefix-#{ fields.body.toLowerCase() }-#{ fields.subdocument.body.toLowerCase() }-suffix"
if fields.body and fields.nested and _.isArray fields.nested
for nested in fields.nested when nested.body
tags.push "tag-#{ tags.length }-prefix-#{ fields.body.toLowerCase() }-#{ nested.body.toLowerCase() }-suffix"
[fields._id, tags]
]
triggers: ->
testTrigger: @Trigger ['body'], (newDocument, oldDocument) ->
return unless newDocument?._id
globalTestTriggerCounters[newDocument._id] = (globalTestTriggerCounters[newDocument._id] or 0) + 1
# Store away for testing
_TestPost = Post
# Extending delayed document
class Post extends Post
@Meta
name: 'Post'
replaceParent: true
fields: (fields) ->
fields.subdocument.persons = [@ReferenceField Person, ['username', 'displayName', 'field1', 'field2'], true, 'subdocumentsPosts', ['body', 'subdocument.body', 'nested.body']]
fields
# Store away for testing
_TestPost2 = Post
class User extends Document
@Meta
name: 'User'
# Specifying collection directly
collection: Meteor.users
class UserLink extends Document
@Meta
name: 'UserLink'
fields: ->
user: @ReferenceField User, ['username'], false
class PostLink extends Document
@Meta
name: 'PostLink'
# Store away for testing
_TestPostLink = PostLink
# To test extending when initial document has no fields
class PostLink extends PostLink
@Meta
name: 'PostLink'
replaceParent: true
fields: ->
post: @ReferenceField Post, ['subdocument.person', 'subdocument.persons']
class CircularFirst extends Document
# Other fields:
# content
@Meta
name: 'CircularFirst'
# Store away for testing
_TestCircularFirst = CircularFirst
# To test extending when initial document has no fields and fields will be delayed
class CircularFirst extends CircularFirst
@Meta
name: 'CircularFirst'
replaceParent: true
fields: (fields) ->
# We can reference circular documents
fields.second = @ReferenceField CircularSecond, ['content'], true, 'reverseFirsts', ['content']
fields
class CircularSecond extends Document
# Other fields:
# content
@Meta
name: 'CircularSecond'
fields: ->
# But of course one should not be required so that we can insert without warnings
first: @ReferenceField CircularFirst, ['content'], false, 'reverseSeconds', ['content']
class Person extends Document
# Other fields:
# username
# displayName
# field1
# field2
@Meta
name: 'Person'
generators: ->
count: @GeneratedField 'self', ['posts', 'subdocument.posts', 'subdocumentsPosts', 'nestedPosts'], (fields) ->
[fields._id, (fields.posts?.length or 0) + (fields.nestedPosts?.length or 0) + (fields.subdocument?.posts?.length or 0) + (fields.subdocumentsPosts?.length or 0)]
# Store away for testing
_TestPerson = Person
# To test if reverse fields *are* added to the extended class which replaces the parent
class Person extends Person
@Meta
name: 'Person'
replaceParent: true
formatName: ->
"#{ @username }-#{ @displayName or "none" }"
# To test if reverse fields are *not* added to the extended class which replaces the parent
class SpecialPerson extends Person
@Meta
name: 'SpecialPerson'
fields: ->
# posts and nestedPosts don't exist, so we remove count field as well
count: undefined
class RecursiveBase extends Document
@Meta
abstract: true
fields: ->
other: @ReferenceField 'self', ['content'], false, 'reverse', ['content']
class Recursive extends RecursiveBase
# Other fields:
# content
@Meta
name: 'Recursive'
class IdentityGenerator extends Document
# Other fields:
# source
@Meta
name: 'IdentityGenerator'
generators: ->
result: @GeneratedField 'self', ['source'], (fields) ->
throw new Error "Test exception" if fields.source is 'exception'
return [fields._id, fields.source]
results: [
@GeneratedField 'self', ['source'], (fields) ->
return [fields._id, fields.source]
]
# Extending and renaming the class, this creates new collection as well
class SpecialPost extends Post
@Meta
name: 'SpecialPost'
fields: ->
special: @ReferenceField Person
# To test redefinig after fields already have a reference to an old document
class Post extends Post
@Meta
name: 'Post'
replaceParent: true
# To test handling of subfield references in bulk insert
class SubfieldItem extends Document
@Meta
name: 'SubfieldItem'
fields: ->
toplevel:
subitem: @ReferenceField 'self', [], false
objectInArray: [
subitem: @ReferenceField 'self', [], false
subitem2: @ReferenceField 'self', []
]
anArray: [@ReferenceField 'self', []]
class LocalPost extends Document
# Other fields:
# body
# subdocument
# body
# nested
# body
@Meta
name: 'LocalPost'
collection: null
fields: ->
author: @ReferenceField LocalPerson, ['username', 'displayName', 'field1', 'field2'], true, 'posts', ['body', 'subdocument.body', 'nested.body']
subscribers: [@ReferenceField LocalPerson]
reviewers: [@ReferenceField LocalPerson, [username: 1]]
subdocument:
person: @ReferenceField LocalPerson, {'username': 1, 'displayName': 1, 'field1': 1, 'field2': 1}, false, 'subdocument.posts', ['body', 'subdocument.body', 'nested.body']
persons: [@ReferenceField LocalPerson, ['username', 'displayName', 'field1', 'field2'], true, 'subdocumentsPosts', ['body', 'subdocument.body', 'nested.body']]
slug: @GeneratedField 'self', ['body', 'subdocument.body'], (fields) ->
if _.isUndefined(fields.body) or _.isUndefined(fields.subdocument?.body)
[fields._id, undefined]
else if _.isNull(fields.body) or _.isNull(fields.subdocument.body)
[fields._id, null]
else
[fields._id, "subdocument-prefix-#{ fields.body.toLowerCase() }-#{ fields.subdocument.body.toLowerCase() }-suffix"]
nested: [
required: @ReferenceField LocalPerson, ['username', 'displayName', 'field1', 'field2'], true, 'nestedPosts', ['body', 'subdocument.body', 'nested.body']
optional: @ReferenceField LocalPerson, ['username'], false
slug: @GeneratedField 'self', ['body', 'nested.body'], (fields) ->
for nested in fields.nested or []
if _.isUndefined(fields.body) or _.isUndefined(nested.body)
[fields._id, undefined]
else if _.isNull(fields.body) or _.isNull(nested.body)
[fields._id, null]
else
[fields._id, "nested-prefix-#{ fields.body.toLowerCase() }-#{ nested.body.toLowerCase() }-suffix"]
]
slug: @GeneratedField 'self', ['body', 'subdocument.body'], (fields) ->
if _.isUndefined(fields.body) or _.isUndefined(fields.subdocument?.body)
[fields._id, undefined]
else if _.isNull(fields.body) or _.isNull(fields.subdocument.body)
[fields._id, null]
else
[fields._id, "prefix-#{ fields.body.toLowerCase() }-#{ fields.subdocument.body.toLowerCase() }-suffix"]
tags: [
@GeneratedField 'self', ['body', 'subdocument.body', 'nested.body'], (fields) ->
tags = []
if fields.body and fields.subdocument?.body
tags.push "tag-#{ tags.length }-prefix-#{ fields.body.toLowerCase() }-#{ fields.subdocument.body.toLowerCase() }-suffix"
if fields.body and fields.nested and _.isArray fields.nested
for nested in fields.nested when nested.body
tags.push "tag-#{ tags.length }-prefix-#{ fields.body.toLowerCase() }-#{ nested.body.toLowerCase() }-suffix"
[fields._id, tags]
]
triggers: ->
testTrigger: @Trigger ['body'], (newDocument, oldDocument) ->
return unless newDocument?._id
globalTestTriggerCounters[newDocument._id] = (globalTestTriggerCounters[newDocument._id] or 0) + 1
class LocalPerson extends Document
# Other fields:
# username
# displayName
# field1
# field2
@Meta
name: 'LocalPerson'
collection: null
fields: ->
count: @GeneratedField 'self', ['posts', 'subdocument.posts', 'subdocumentsPosts', 'nestedPosts'], (fields) ->
[fields._id, (fields.posts?.length or 0) + (fields.nestedPosts?.length or 0) + (fields.subdocument?.posts?.length or 0) + (fields.subdocumentsPosts?.length or 0)]
formatName: ->
"#{ @username }-#{ @displayName or "none" }"
Document.defineAll()
# Just to make sure things are sane
assert.equal Document._delayed.length, 0
if Meteor.isServer
# Initialize the database
try
Post.Meta.collection._dropCollection()
User.Meta.collection._dropCollection()
UserLink.Meta.collection._dropCollection()
PostLink.Meta.collection._dropCollection()
CircularFirst.Meta.collection._dropCollection()
CircularSecond.Meta.collection._dropCollection()
Person.Meta.collection._dropCollection()
SpecialPerson.Meta.collection._dropCollection()
Recursive.Meta.collection._dropCollection()
IdentityGenerator.Meta.collection._dropCollection()
SpecialPost.Meta.collection._dropCollection()
SubfieldItem.Meta.collection._dropCollection()
catch error
throw error unless /ns not found/.test "#{error}"
Meteor.publish null, ->
Post.documents.find()
# User is already published as Meteor.users
Meteor.publish null, ->
UserLink.documents.find()
Meteor.publish null, ->
PostLink.documents.find()
Meteor.publish null, ->
CircularFirst.documents.find()
Meteor.publish null, ->
CircularSecond.documents.find()
Meteor.publish null, ->
Person.documents.find()
Meteor.publish null, ->
Recursive.documents.find()
Meteor.publish null, ->
IdentityGenerator.documents.find()
Meteor.publish null, ->
SpecialPost.documents.find()
Meteor.publish null, ->
SubfieldItem.documents.find()
Future = Npm.require 'fibers/future'
Meteor.methods
'wait-for-database': ->
future = new Future()
timeout = null
newTimeout = ->
Meteor.clearTimeout timeout if timeout
timeout = Meteor.setTimeout ->
timeout = null
future.return() unless future.isResolved()
, WAIT_FOR_DATABASE_TIMEOUT
newTimeout()
handles = []
for document in Document.list
do (document) ->
handles.push document.documents.find({}).observeChanges
added: (id, fields) ->
newTimeout()
changed: (id, fields) ->
newTimeout()
removed: (id) ->
newTimeout()
future.wait()
for handle in handles
handle.stop()
waitForDatabase = (test, expect) ->
Meteor.call 'wait-for-database', expect (error) ->
test.isFalse error, error?.toString?() or error
ALL = @ALL = [User, UserLink, CircularFirst, CircularSecond, SpecialPerson, Recursive, IdentityGenerator, SpecialPost, Post, Person, PostLink, SubfieldItem, LocalPost, LocalPerson]
testDocumentList = (test, list) ->
test.equal Document.list, list, "expected: #{ (d.Meta._name for d in list) } vs. actual: #{ (d.Meta._name for d in Document.list) }"
intersectionObjects = (array, rest...) ->
_.filter _.uniq(array), (item) ->
_.every rest, (other) ->
_.any other, (element) -> _.isEqual element, item
testSetEqual = (test, a, b) ->
a ||= []
b ||= []
if a.length is b.length and intersectionObjects(a, b).length is a.length
test.ok()
else
test.fail
type: 'assert_set_equal'
actual: JSON.stringify a
expected: JSON.stringify b
testDefinition = (test) ->
test.equal Post.Meta._name, 'Post'
test.equal Post.Meta.parent, _TestPost2.Meta
test.equal Post.Meta.document, Post
test.equal Post.Meta.collection._name, 'Posts'
test.equal _.size(Post.Meta.triggers), 1
test.instanceOf Post.Meta.triggers.testTrigger, Post._Trigger
test.equal Post.Meta.triggers.testTrigger.name, 'testTrigger'
test.equal Post.Meta.triggers.testTrigger.document, Post
test.equal Post.Meta.triggers.testTrigger.collection._name, 'Posts'
test.equal Post.Meta.triggers.testTrigger.fields, ['body']
test.equal _.size(Post.Meta.generators), 2
test.equal _.size(Post.Meta.generators.subdocument), 1
test.instanceOf Post.Meta.generators.subdocument.slug, Post._GeneratedField
test.isNull Post.Meta.generators.subdocument.slug.ancestorArray, Post.Meta.generators.subdocument.slug.ancestorArray
test.isTrue _.isFunction Post.Meta.generators.subdocument.slug.generator
test.equal Post.Meta.generators.subdocument.slug.sourcePath, 'subdocument.slug'
test.equal Post.Meta.generators.subdocument.slug.sourceDocument, Post
test.equal Post.Meta.generators.subdocument.slug.targetDocument, Post
test.equal Post.Meta.generators.subdocument.slug.sourceCollection._name, 'Posts'
test.equal Post.Meta.generators.subdocument.slug.targetCollection._name, 'Posts'
test.equal Post.Meta.generators.subdocument.slug.sourceDocument.Meta.collection._name, 'Posts'
test.equal Post.Meta.generators.subdocument.slug.targetDocument.Meta.collection._name, 'Posts'
test.equal Post.Meta.generators.subdocument.slug.fields, ['body', 'subdocument.body']
test.isUndefined Post.Meta.generators.subdocument.slug.reverseName
test.isUndefined Post.Meta.generators.subdocument.slug.reverseFields
test.instanceOf Post.Meta.generators.tags, Post._GeneratedField
test.equal Post.Meta.generators.tags.ancestorArray, 'tags'
test.isTrue _.isFunction Post.Meta.generators.tags.generator
test.equal Post.Meta.generators.tags.sourcePath, 'tags'
test.equal Post.Meta.generators.tags.sourceDocument, Post
test.equal Post.Meta.generators.tags.targetDocument, Post
test.equal Post.Meta.generators.tags.sourceCollection._name, 'Posts'
test.equal Post.Meta.generators.tags.targetCollection._name, 'Posts'
test.equal Post.Meta.generators.tags.sourceDocument.Meta.collection._name, 'Posts'
test.equal Post.Meta.generators.tags.targetDocument.Meta.collection._name, 'Posts'
test.equal Post.Meta.generators.tags.fields, ['body', 'subdocument.body', 'nested.body']
test.isUndefined Post.Meta.generators.tags.reverseName
test.isUndefined Post.Meta.generators.tags.reverseFields
test.equal _.size(Post.Meta.fields), 6
test.instanceOf Post.Meta.fields.author, Post._ReferenceField
test.isNull Post.Meta.fields.author.ancestorArray, Post.Meta.fields.author.ancestorArray
test.isTrue Post.Meta.fields.author.required
test.equal Post.Meta.fields.author.sourcePath, 'author'
test.equal Post.Meta.fields.author.sourceDocument, Post
test.equal Post.Meta.fields.author.targetDocument, Person
test.equal Post.Meta.fields.author.sourceCollection._name, 'Posts'
test.equal Post.Meta.fields.author.targetCollection._name, 'Persons'
test.equal Post.Meta.fields.author.sourceDocument.Meta.collection._name, 'Posts'
test.equal Post.Meta.fields.author.targetDocument.Meta.collection._name, 'Persons'
test.equal Post.Meta.fields.author.fields, ['username', 'displayName', 'field1', 'field2']
test.equal Post.Meta.fields.author.reverseName, 'posts'
test.equal Post.Meta.fields.author.reverseFields, ['body', 'subdocument.body', 'nested.body']
test.instanceOf Post.Meta.fields.subscribers, Post._ReferenceField
test.equal Post.Meta.fields.subscribers.ancestorArray, 'subscribers'
test.isTrue Post.Meta.fields.subscribers.required
test.equal Post.Meta.fields.subscribers.sourcePath, 'subscribers'
test.equal Post.Meta.fields.subscribers.sourceDocument, Post
test.equal Post.Meta.fields.subscribers.targetDocument, Person
test.equal Post.Meta.fields.subscribers.sourceCollection._name, 'Posts'
test.equal Post.Meta.fields.subscribers.targetCollection._name, 'Persons'
test.equal Post.Meta.fields.subscribers.sourceDocument.Meta.collection._name, 'Posts'
test.equal Post.Meta.fields.subscribers.targetDocument.Meta.collection._name, 'Persons'
test.equal Post.Meta.fields.subscribers.fields, []
test.isNull Post.Meta.fields.subscribers.reverseName
test.equal Post.Meta.fields.subscribers.reverseFields, []
test.instanceOf Post.Meta.fields.reviewers, Post._ReferenceField
test.equal Post.Meta.fields.reviewers.ancestorArray, 'reviewers'
test.isTrue Post.Meta.fields.reviewers.required
test.equal Post.Meta.fields.reviewers.sourcePath, 'reviewers'
test.equal Post.Meta.fields.reviewers.sourceDocument, Post
test.equal Post.Meta.fields.reviewers.targetDocument, Person
test.equal Post.Meta.fields.reviewers.sourceCollection._name, 'Posts'
test.equal Post.Meta.fields.reviewers.targetCollection._name, 'Persons'
test.equal Post.Meta.fields.reviewers.sourceDocument.Meta.collection._name, 'Posts'
test.equal Post.Meta.fields.reviewers.targetDocument.Meta.collection._name, 'Persons'
test.equal Post.Meta.fields.reviewers.fields, [username: 1]
test.isNull Post.Meta.fields.reviewers.reverseName
test.equal Post.Meta.fields.reviewers.reverseFields, []
test.equal _.size(Post.Meta.fields.subdocument), 2
test.instanceOf Post.Meta.fields.subdocument.person, Post._ReferenceField
test.isNull Post.Meta.fields.subdocument.person.ancestorArray, Post.Meta.fields.subdocument.person.ancestorArray
test.isFalse Post.Meta.fields.subdocument.person.required
test.equal Post.Meta.fields.subdocument.person.sourcePath, 'subdocument.person'
test.equal Post.Meta.fields.subdocument.person.sourceDocument, Post
test.equal Post.Meta.fields.subdocument.person.targetDocument, Person
test.equal Post.Meta.fields.subdocument.person.sourceCollection._name, 'Posts'
test.equal Post.Meta.fields.subdocument.person.targetCollection._name, 'Persons'
test.equal Post.Meta.fields.subdocument.person.sourceDocument.Meta.collection._name, 'Posts'
test.equal Post.Meta.fields.subdocument.person.targetDocument.Meta.collection._name, 'Persons'
test.equal Post.Meta.fields.subdocument.person.fields, {'username': 1, 'displayName': 1, 'field1': 1, 'field2': 1}
test.equal Post.Meta.fields.subdocument.person.reverseName, 'subdocument.posts'
test.equal Post.Meta.fields.subdocument.person.reverseFields, ['body', 'subdocument.body', 'nested.body']
test.instanceOf Post.Meta.fields.subdocument.persons, Post._ReferenceField
test.equal Post.Meta.fields.subdocument.persons.ancestorArray, 'subdocument.persons'
test.isTrue Post.Meta.fields.subdocument.persons.required
test.equal Post.Meta.fields.subdocument.persons.sourcePath, 'subdocument.persons'
test.equal Post.Meta.fields.subdocument.persons.sourceDocument, Post
test.equal Post.Meta.fields.subdocument.persons.targetDocument, Person
test.equal Post.Meta.fields.subdocument.persons.sourceCollection._name, 'Posts'
test.equal Post.Meta.fields.subdocument.persons.targetCollection._name, 'Persons'
test.equal Post.Meta.fields.subdocument.persons.sourceDocument.Meta.collection._name, 'Posts'
test.equal Post.Meta.fields.subdocument.persons.targetDocument.Meta.collection._name, 'Persons'
test.equal Post.Meta.fields.subdocument.persons.fields, ['username', 'displayName', 'field1', 'field2']
test.equal Post.Meta.fields.subdocument.persons.reverseName, 'subdocumentsPosts'
test.equal Post.Meta.fields.subdocument.persons.reverseFields, ['body', 'subdocument.body', 'nested.body']
test.equal _.size(Post.Meta.fields.nested), 3
test.instanceOf Post.Meta.fields.nested.required, Post._ReferenceField
test.equal Post.Meta.fields.nested.required.ancestorArray, 'nested'
test.isTrue Post.Meta.fields.nested.required.required
test.equal Post.Meta.fields.nested.required.sourcePath, 'nested.required'
test.equal Post.Meta.fields.nested.required.sourceDocument, Post
test.equal Post.Meta.fields.nested.required.targetDocument, Person
test.equal Post.Meta.fields.nested.required.sourceCollection._name, 'Posts'
test.equal Post.Meta.fields.nested.required.targetCollection._name, 'Persons'
test.equal Post.Meta.fields.nested.required.sourceDocument.Meta.collection._name, 'Posts'
test.equal Post.Meta.fields.nested.required.targetDocument.Meta.collection._name, 'Persons'
test.equal Post.Meta.fields.nested.required.fields, ['username', 'displayName', 'field1', 'field2']
test.equal Post.Meta.fields.nested.required.reverseName, 'nestedPosts'
test.equal Post.Meta.fields.nested.required.reverseFields, ['body', 'subdocument.body', 'nested.body']
test.instanceOf Post.Meta.fields.nested.optional, Post._ReferenceField
test.equal Post.Meta.fields.nested.optional.ancestorArray, 'nested'
test.isFalse Post.Meta.fields.nested.optional.required
test.equal Post.Meta.fields.nested.optional.sourcePath, 'nested.optional'
test.equal Post.Meta.fields.nested.optional.sourceDocument, Post
test.equal Post.Meta.fields.nested.optional.targetDocument, Person
test.equal Post.Meta.fields.nested.optional.sourceCollection._name, 'Posts'
test.equal Post.Meta.fields.nested.optional.targetCollection._name, 'Persons'
test.equal Post.Meta.fields.nested.optional.sourceDocument.Meta.collection._name, 'Posts'
test.equal Post.Meta.fields.nested.optional.targetDocument.Meta.collection._name, 'Persons'
test.equal Post.Meta.fields.nested.optional.fields, ['username']
test.isNull Post.Meta.fields.nested.optional.reverseName
test.equal Post.Meta.fields.nested.optional.reverseFields, []
test.instanceOf Post.Meta.fields.nested.slug, Post._GeneratedField
test.equal Post.Meta.fields.nested.slug.ancestorArray, 'nested'
test.isTrue _.isFunction Post.Meta.fields.nested.slug.generator
test.equal Post.Meta.fields.nested.slug.sourcePath, 'nested.slug'
test.equal Post.Meta.fields.nested.slug.sourceDocument, Post
test.equal Post.Meta.fields.nested.slug.targetDocument, Post
test.equal Post.Meta.fields.nested.slug.sourceCollection._name, 'Posts'
test.equal Post.Meta.fields.nested.slug.targetCollection._name, 'Posts'
test.equal Post.Meta.fields.nested.slug.sourceDocument.Meta.collection._name, 'Posts'
test.equal Post.Meta.fields.nested.slug.targetDocument.Meta.collection._name, 'Posts'
test.equal Post.Meta.fields.nested.slug.fields, ['body', 'nested.body']
test.isUndefined Post.Meta.fields.nested.slug.reverseName
test.isUndefined Post.Meta.fields.nested.slug.reverseFields
test.instanceOf Post.Meta.fields.slug, Post._GeneratedField
test.isNull Post.Meta.fields.slug.ancestorArray, Post.Meta.fields.slug.ancestorArray
test.isTrue _.isFunction Post.Meta.fields.slug.generator
test.equal Post.Meta.fields.slug.sourcePath, 'slug'
test.equal Post.Meta.fields.slug.sourceDocument, Post
test.equal Post.Meta.fields.slug.targetDocument, Post
test.equal Post.Meta.fields.slug.sourceCollection._name, 'Posts'
test.equal Post.Meta.fields.slug.targetCollection._name, 'Posts'
test.equal Post.Meta.fields.slug.sourceDocument.Meta.collection._name, 'Posts'
test.equal Post.Meta.fields.slug.targetDocument.Meta.collection._name, 'Posts'
test.equal Post.Meta.fields.slug.fields, ['body', 'subdocument.body']
test.isUndefined Post.Meta.fields.slug.reverseName
test.isUndefined Post.Meta.fields.slug.reverseFields
test.isTrue Post.Meta._observersSetup
test.equal User.Meta._name, 'User'
test.isFalse User.Meta.parent
test.equal User.Meta.document, User
test.equal User.Meta.collection._name, 'users'
test.equal _.size(User.Meta.triggers), 0
test.equal _.size(User.Meta.fields), 0
test.isTrue User.Meta._observersSetup
test.equal UserLink.Meta._name, 'UserLink'
test.isFalse UserLink.Meta.parent
test.equal UserLink.Meta.document, UserLink
test.equal UserLink.Meta.collection._name, 'UserLinks'
test.equal _.size(UserLink.Meta.triggers), 0
test.equal _.size(UserLink.Meta.fields), 1
test.instanceOf UserLink.Meta.fields.user, UserLink._ReferenceField
test.isNull UserLink.Meta.fields.user.ancestorArray, UserLink.Meta.fields.user.ancestorArray
test.isFalse UserLink.Meta.fields.user.required
test.equal UserLink.Meta.fields.user.sourcePath, 'user'
test.equal UserLink.Meta.fields.user.sourceDocument, UserLink
test.equal UserLink.Meta.fields.user.targetDocument, User
test.equal UserLink.Meta.fields.user.sourceCollection._name, 'UserLinks'
test.equal UserLink.Meta.fields.user.targetCollection._name, 'users'
test.equal UserLink.Meta.fields.user.sourceDocument.Meta.collection._name, 'UserLinks'
test.equal UserLink.Meta.fields.user.fields, ['username']
test.isNull UserLink.Meta.fields.user.reverseName
test.equal UserLink.Meta.fields.user.reverseFields, []
test.isTrue UserLink.Meta._observersSetup
test.equal PostLink.Meta._name, 'PostLink'
test.equal PostLink.Meta.parent, _TestPostLink.Meta
test.equal PostLink.Meta.document, PostLink
test.equal PostLink.Meta.collection._name, 'PostLinks'
test.equal _.size(PostLink.Meta.triggers), 0
test.equal _.size(PostLink.Meta.fields), 1
test.instanceOf PostLink.Meta.fields.post, PostLink._ReferenceField
test.isNull PostLink.Meta.fields.post.ancestorArray, PostLink.Meta.fields.post.ancestorArray
test.isTrue PostLink.Meta.fields.post.required
test.equal PostLink.Meta.fields.post.sourcePath, 'post'
test.equal PostLink.Meta.fields.post.sourceDocument, PostLink
test.equal PostLink.Meta.fields.post.targetDocument, Post
test.equal PostLink.Meta.fields.post.sourceCollection._name, 'PostLinks'
test.equal PostLink.Meta.fields.post.targetCollection._name, 'Posts'
test.equal PostLink.Meta.fields.post.sourceDocument.Meta.collection._name, 'PostLinks'
test.equal PostLink.Meta.fields.post.fields, ['subdocument.person', 'subdocument.persons']
test.isNull PostLink.Meta.fields.post.reverseName
test.equal PostLink.Meta.fields.post.reverseFields, []
test.isTrue PostLink.Meta._observersSetup
test.equal CircularFirst.Meta._name, 'CircularFirst'
test.equal CircularFirst.Meta.parent, _TestCircularFirst.Meta
test.equal CircularFirst.Meta.document, CircularFirst
test.equal CircularFirst.Meta.collection._name, 'CircularFirsts'
test.equal _.size(CircularFirst.Meta.triggers), 0
test.equal _.size(CircularFirst.Meta.fields), 2
test.instanceOf CircularFirst.Meta.fields.second, CircularFirst._ReferenceField
test.isNull CircularFirst.Meta.fields.second.ancestorArray, CircularFirst.Meta.fields.second.ancestorArray
test.isTrue CircularFirst.Meta.fields.second.required
test.equal CircularFirst.Meta.fields.second.sourcePath, 'second'
test.equal CircularFirst.Meta.fields.second.sourceDocument, CircularFirst
test.equal CircularFirst.Meta.fields.second.targetDocument, CircularSecond
test.equal CircularFirst.Meta.fields.second.sourceCollection._name, 'CircularFirsts'
test.equal CircularFirst.Meta.fields.second.targetCollection._name, 'CircularSeconds'
test.equal CircularFirst.Meta.fields.second.sourceDocument.Meta.collection._name, 'CircularFirsts'
test.equal CircularFirst.Meta.fields.second.targetDocument.Meta.collection._name, 'CircularSeconds'
test.equal CircularFirst.Meta.fields.second.fields, ['content']
test.equal CircularFirst.Meta.fields.second.reverseName, 'reverseFirsts'
test.equal CircularFirst.Meta.fields.second.reverseFields, ['content']
test.instanceOf CircularFirst.Meta.fields.reverseSeconds, CircularFirst._ReferenceField
test.equal CircularFirst.Meta.fields.reverseSeconds.ancestorArray, 'reverseSeconds'
test.isTrue CircularFirst.Meta.fields.reverseSeconds.required
test.equal CircularFirst.Meta.fields.reverseSeconds.sourcePath, 'reverseSeconds'
test.equal CircularFirst.Meta.fields.reverseSeconds.sourceDocument, CircularFirst
test.equal CircularFirst.Meta.fields.reverseSeconds.targetDocument, CircularSecond
test.equal CircularFirst.Meta.fields.reverseSeconds.sourceCollection._name, 'CircularFirsts'
test.equal CircularFirst.Meta.fields.reverseSeconds.targetCollection._name, 'CircularSeconds'
test.equal CircularFirst.Meta.fields.reverseSeconds.sourceDocument.Meta.collection._name, 'CircularFirsts'
test.equal CircularFirst.Meta.fields.reverseSeconds.targetDocument.Meta.collection._name, 'CircularSeconds'
test.equal CircularFirst.Meta.fields.reverseSeconds.fields, ['content']
test.isNull CircularFirst.Meta.fields.reverseSeconds.reverseName
test.equal CircularFirst.Meta.fields.reverseSeconds.reverseFields, []
test.isTrue CircularFirst.Meta._observersSetup
test.equal CircularSecond.Meta._name, 'CircularSecond'
test.isFalse CircularSecond.Meta.parent
test.equal CircularSecond.Meta.document, CircularSecond
test.equal CircularSecond.Meta.collection._name, 'CircularSeconds'
test.equal _.size(CircularSecond.Meta.triggers), 0
test.equal _.size(CircularSecond.Meta.fields), 2
test.instanceOf CircularSecond.Meta.fields.first, CircularSecond._ReferenceField
test.isNull CircularSecond.Meta.fields.first.ancestorArray, CircularSecond.Meta.fields.first.ancestorArray
test.isFalse CircularSecond.Meta.fields.first.required
test.equal CircularSecond.Meta.fields.first.sourcePath, 'first'
test.equal CircularSecond.Meta.fields.first.sourceDocument, CircularSecond
test.equal CircularSecond.Meta.fields.first.targetDocument, CircularFirst
test.equal CircularSecond.Meta.fields.first.sourceCollection._name, 'CircularSeconds'
test.equal CircularSecond.Meta.fields.first.targetCollection._name, 'CircularFirsts'
test.equal CircularSecond.Meta.fields.first.sourceDocument.Meta.collection._name, 'CircularSeconds'
test.equal CircularSecond.Meta.fields.first.targetDocument.Meta.collection._name, 'CircularFirsts'
test.equal CircularSecond.Meta.fields.first.fields, ['content']
test.equal CircularSecond.Meta.fields.first.reverseName, 'reverseSeconds'
test.equal CircularSecond.Meta.fields.first.reverseFields, ['content']
test.instanceOf CircularSecond.Meta.fields.reverseFirsts, CircularSecond._ReferenceField
test.equal CircularSecond.Meta.fields.reverseFirsts.ancestorArray, 'reverseFirsts'
test.isTrue CircularSecond.Meta.fields.reverseFirsts.required
test.equal CircularSecond.Meta.fields.reverseFirsts.sourcePath, 'reverseFirsts'
test.equal CircularSecond.Meta.fields.reverseFirsts.sourceDocument, CircularSecond
test.equal CircularSecond.Meta.fields.reverseFirsts.targetDocument, CircularFirst
test.equal CircularSecond.Meta.fields.reverseFirsts.sourceCollection._name, 'CircularSeconds'
test.equal CircularSecond.Meta.fields.reverseFirsts.targetCollection._name, 'CircularFirsts'
test.equal CircularSecond.Meta.fields.reverseFirsts.sourceDocument.Meta.collection._name, 'CircularSeconds'
test.equal CircularSecond.Meta.fields.reverseFirsts.targetDocument.Meta.collection._name, 'CircularFirsts'
test.equal CircularSecond.Meta.fields.reverseFirsts.fields, ['content']
test.isNull CircularSecond.Meta.fields.reverseFirsts.reverseName
test.equal CircularSecond.Meta.fields.reverseFirsts.reverseFields, []
test.isTrue CircularSecond.Meta._observersSetup
test.equal Person.Meta._name, 'Person'
test.equal Person.Meta.parent, _TestPerson.Meta
test.equal Person.Meta.document, Person
test.equal Person.Meta.collection._name, 'Persons'
test.equal _.size(Person.Meta.triggers), 0
test.equal _.size(Person.Meta.generators), 1
test.instanceOf Person.Meta.generators.count, Person._GeneratedField
test.isNull Person.Meta.generators.count.ancestorArray, Person.Meta.generators.count.ancestorArray
test.isTrue _.isFunction Person.Meta.generators.count.generator
test.equal Person.Meta.generators.count.sourcePath, 'count'
test.equal Person.Meta.generators.count.sourceDocument, Person
test.equal Person.Meta.generators.count.targetDocument, Person
test.equal Person.Meta.generators.count.sourceCollection._name, 'Persons'
test.equal Person.Meta.generators.count.targetCollection._name, 'Persons'
test.equal Person.Meta.generators.count.sourceDocument.Meta.collection._name, 'Persons'
test.equal Person.Meta.generators.count.targetDocument.Meta.collection._name, 'Persons'
test.equal Person.Meta.generators.count.fields, ['posts', 'subdocument.posts', 'subdocumentsPosts', 'nestedPosts']
test.isUndefined Person.Meta.generators.count.reverseName
test.isUndefined Person.Meta.generators.count.reverseFields
test.equal _.size(Person.Meta.fields), 4
test.instanceOf Person.Meta.fields.posts, Person._ReferenceField
test.equal Person.Meta.fields.posts.ancestorArray, 'posts'
test.isTrue Person.Meta.fields.posts.required
test.equal Person.Meta.fields.posts.sourcePath, 'posts'
test.equal Person.Meta.fields.posts.sourceDocument, Person
test.equal Person.Meta.fields.posts.targetDocument, Post
test.equal Person.Meta.fields.posts.sourceCollection._name, 'Persons'
test.equal Person.Meta.fields.posts.targetCollection._name, 'Posts'
test.equal Person.Meta.fields.posts.sourceDocument.Meta.collection._name, 'Persons'
test.equal Person.Meta.fields.posts.targetDocument.Meta.collection._name, 'Posts'
test.equal Person.Meta.fields.posts.fields, ['body', 'subdocument.body', 'nested.body']
test.isNull Person.Meta.fields.posts.reverseName
test.equal Person.Meta.fields.posts.reverseFields, []
test.instanceOf Person.Meta.fields.nestedPosts, Person._ReferenceField
test.equal Person.Meta.fields.nestedPosts.ancestorArray, 'nestedPosts'
test.isTrue Person.Meta.fields.nestedPosts.required
test.equal Person.Meta.fields.nestedPosts.sourcePath, 'nestedPosts'
test.equal Person.Meta.fields.nestedPosts.sourceDocument, Person
test.equal Person.Meta.fields.nestedPosts.targetDocument, Post
test.equal Person.Meta.fields.nestedPosts.sourceCollection._name, 'Persons'
test.equal Person.Meta.fields.nestedPosts.targetCollection._name, 'Posts'
test.equal Person.Meta.fields.nestedPosts.sourceDocument.Meta.collection._name, 'Persons'
test.equal Person.Meta.fields.nestedPosts.targetDocument.Meta.collection._name, 'Posts'
test.equal Person.Meta.fields.nestedPosts.fields, ['body', 'subdocument.body', 'nested.body']
test.isNull Person.Meta.fields.nestedPosts.reverseName
test.equal Person.Meta.fields.nestedPosts.reverseFields, []
test.instanceOf Person.Meta.fields.subdocument.posts, Person._ReferenceField
test.equal Person.Meta.fields.subdocument.posts.ancestorArray, 'subdocument.posts'
test.isTrue Person.Meta.fields.subdocument.posts.required
test.equal Person.Meta.fields.subdocument.posts.sourcePath, 'subdocument.posts'
test.equal Person.Meta.fields.subdocument.posts.sourceDocument, Person
test.equal Person.Meta.fields.subdocument.posts.targetDocument, Post
test.equal Person.Meta.fields.subdocument.posts.sourceCollection._name, 'Persons'
test.equal Person.Meta.fields.subdocument.posts.targetCollection._name, 'Posts'
test.equal Person.Meta.fields.subdocument.posts.sourceDocument.Meta.collection._name, 'Persons'
test.equal Person.Meta.fields.subdocument.posts.targetDocument.Meta.collection._name, 'Posts'
test.equal Person.Meta.fields.subdocument.posts.fields, ['body', 'subdocument.body', 'nested.body']
test.isNull Person.Meta.fields.subdocument.posts.reverseName
test.equal Person.Meta.fields.subdocument.posts.reverseFields, []
test.instanceOf Person.Meta.fields.subdocumentsPosts, Person._ReferenceField
test.equal Person.Meta.fields.subdocumentsPosts.ancestorArray, 'subdocumentsPosts'
test.isTrue Person.Meta.fields.subdocumentsPosts.required
test.equal Person.Meta.fields.subdocumentsPosts.sourcePath, 'subdocumentsPosts'
test.equal Person.Meta.fields.subdocumentsPosts.sourceDocument, Person
test.equal Person.Meta.fields.subdocumentsPosts.targetDocument, Post
test.equal Person.Meta.fields.subdocumentsPosts.sourceCollection._name, 'Persons'
test.equal Person.Meta.fields.subdocumentsPosts.targetCollection._name, 'Posts'
test.equal Person.Meta.fields.subdocumentsPosts.sourceDocument.Meta.collection._name, 'Persons'
test.equal Person.Meta.fields.subdocumentsPosts.targetDocument.Meta.collection._name, 'Posts'
test.equal Person.Meta.fields.subdocumentsPosts.fields, ['body', 'subdocument.body', 'nested.body']
test.isNull Person.Meta.fields.subdocumentsPosts.reverseName
test.equal Person.Meta.fields.subdocumentsPosts.reverseFields, []
test.isTrue Person.Meta._observersSetup
test.equal SpecialPerson.Meta._name, 'SpecialPerson'
test.equal SpecialPerson.Meta.parent, Person.Meta
test.equal SpecialPerson.Meta.document, SpecialPerson
test.equal SpecialPerson.Meta._name, 'SpecialPerson'
test.equal SpecialPerson.Meta.collection._name, 'SpecialPersons'
test.equal _.size(SpecialPerson.Meta.triggers), 0
test.equal _.size(SpecialPerson.Meta.fields), 0
test.isTrue SpecialPerson.Meta._observersSetup
test.equal Recursive.Meta._name, 'Recursive'
test.isFalse Recursive.Meta.parent
test.equal Recursive.Meta.document, Recursive
test.equal Recursive.Meta.collection._name, 'Recursives'
test.equal _.size(Recursive.Meta.triggers), 0
test.equal _.size(Recursive.Meta.fields), 2
test.instanceOf Recursive.Meta.fields.other, Recursive._ReferenceField
test.isNull Recursive.Meta.fields.other.ancestorArray, Recursive.Meta.fields.other.ancestorArray
test.isFalse Recursive.Meta.fields.other.required
test.equal Recursive.Meta.fields.other.sourcePath, 'other'
test.equal Recursive.Meta.fields.other.sourceDocument, Recursive
test.equal Recursive.Meta.fields.other.targetDocument, Recursive
test.equal Recursive.Meta.fields.other.sourceCollection._name, 'Recursives'
test.equal Recursive.Meta.fields.other.targetCollection._name, 'Recursives'
test.equal Recursive.Meta.fields.other.sourceDocument.Meta.collection._name, 'Recursives'
test.equal Recursive.Meta.fields.other.targetDocument.Meta.collection._name, 'Recursives'
test.equal Recursive.Meta.fields.other.fields, ['content']
test.equal Recursive.Meta.fields.other.reverseName, 'reverse'
test.equal Recursive.Meta.fields.other.reverseFields, ['content']
test.instanceOf Recursive.Meta.fields.reverse, Recursive._ReferenceField
test.equal Recursive.Meta.fields.reverse.ancestorArray, 'reverse'
test.isTrue Recursive.Meta.fields.reverse.required
test.equal Recursive.Meta.fields.reverse.sourcePath, 'reverse'
test.equal Recursive.Meta.fields.reverse.sourceDocument, Recursive
test.equal Recursive.Meta.fields.reverse.targetDocument, Recursive
test.equal Recursive.Meta.fields.reverse.sourceCollection._name, 'Recursives'
test.equal Recursive.Meta.fields.reverse.targetCollection._name, 'Recursives'
test.equal Recursive.Meta.fields.reverse.sourceDocument.Meta.collection._name, 'Recursives'
test.equal Recursive.Meta.fields.reverse.targetDocument.Meta.collection._name, 'Recursives'
test.equal Recursive.Meta.fields.reverse.fields, ['content']
test.isNull Recursive.Meta.fields.reverse.reverseName
test.equal Recursive.Meta.fields.reverse.reverseFields, []
test.isTrue Recursive.Meta._observersSetup
test.equal IdentityGenerator.Meta._name, 'IdentityGenerator'
test.isFalse IdentityGenerator.Meta.parent
test.equal IdentityGenerator.Meta.document, IdentityGenerator
test.equal IdentityGenerator.Meta.collection._name, 'IdentityGenerators'
test.equal _.size(IdentityGenerator.Meta.triggers), 0
test.equal _.size(IdentityGenerator.Meta.generators), 2
test.instanceOf IdentityGenerator.Meta.generators.result, IdentityGenerator._GeneratedField
test.isNull IdentityGenerator.Meta.generators.result.ancestorArray, IdentityGenerator.Meta.generators.result.ancestorArray
test.isTrue _.isFunction IdentityGenerator.Meta.generators.result.generator
test.equal IdentityGenerator.Meta.generators.result.sourcePath, 'result'
test.equal IdentityGenerator.Meta.generators.result.sourceDocument, IdentityGenerator
test.equal IdentityGenerator.Meta.generators.result.targetDocument, IdentityGenerator
test.equal IdentityGenerator.Meta.generators.result.sourceCollection._name, 'IdentityGenerators'
test.equal IdentityGenerator.Meta.generators.result.targetCollection._name, 'IdentityGenerators'
test.equal IdentityGenerator.Meta.generators.result.sourceDocument.Meta.collection._name, 'IdentityGenerators'
test.equal IdentityGenerator.Meta.generators.result.targetDocument.Meta.collection._name, 'IdentityGenerators'
test.equal IdentityGenerator.Meta.generators.result.fields, ['source']
test.isUndefined IdentityGenerator.Meta.generators.result.reverseName
test.isUndefined IdentityGenerator.Meta.generators.result.reverseFields
test.instanceOf IdentityGenerator.Meta.generators.results, IdentityGenerator._GeneratedField
test.equal IdentityGenerator.Meta.generators.results.ancestorArray, 'results'
test.isTrue _.isFunction IdentityGenerator.Meta.generators.results.generator
test.equal IdentityGenerator.Meta.generators.results.sourcePath, 'results'
test.equal IdentityGenerator.Meta.generators.results.sourceDocument, IdentityGenerator
test.equal IdentityGenerator.Meta.generators.results.targetDocument, IdentityGenerator
test.equal IdentityGenerator.Meta.generators.results.sourceCollection._name, 'IdentityGenerators'
test.equal IdentityGenerator.Meta.generators.results.targetCollection._name, 'IdentityGenerators'
test.equal IdentityGenerator.Meta.generators.results.sourceDocument.Meta.collection._name, 'IdentityGenerators'
test.equal IdentityGenerator.Meta.generators.results.targetDocument.Meta.collection._name, 'IdentityGenerators'
test.equal IdentityGenerator.Meta.generators.results.fields, ['source']
test.isUndefined IdentityGenerator.Meta.generators.results.reverseName
test.isUndefined IdentityGenerator.Meta.generators.results.reverseFields
test.equal _.size(IdentityGenerator.Meta.fields), 0
test.isTrue IdentityGenerator.Meta._observersSetup
test.equal SpecialPost.Meta._name, 'SpecialPost'
test.equal SpecialPost.Meta.parent, _TestPost2.Meta
test.equal SpecialPost.Meta.document, SpecialPost
test.equal SpecialPost.Meta.collection._name, 'SpecialPosts'
test.equal _.size(SpecialPost.Meta.triggers), 1
test.instanceOf SpecialPost.Meta.triggers.testTrigger, SpecialPost._Trigger
test.equal SpecialPost.Meta.triggers.testTrigger.name, 'testTrigger'
test.equal SpecialPost.Meta.triggers.testTrigger.document, SpecialPost
test.equal SpecialPost.Meta.triggers.testTrigger.collection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.triggers.testTrigger.fields, ['body']
test.equal _.size(SpecialPost.Meta.generators), 2
test.equal _.size(SpecialPost.Meta.generators.subdocument), 1
test.instanceOf SpecialPost.Meta.generators.subdocument.slug, SpecialPost._GeneratedField
test.isNull SpecialPost.Meta.generators.subdocument.slug.ancestorArray, SpecialPost.Meta.generators.subdocument.slug.ancestorArray
test.isTrue _.isFunction SpecialPost.Meta.generators.subdocument.slug.generator
test.equal SpecialPost.Meta.generators.subdocument.slug.sourcePath, 'subdocument.slug'
test.equal SpecialPost.Meta.generators.subdocument.slug.sourceDocument, SpecialPost
test.equal SpecialPost.Meta.generators.subdocument.slug.targetDocument, SpecialPost
test.equal SpecialPost.Meta.generators.subdocument.slug.sourceCollection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.generators.subdocument.slug.targetCollection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.generators.subdocument.slug.sourceDocument.Meta.collection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.generators.subdocument.slug.targetDocument.Meta.collection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.generators.subdocument.slug.fields, ['body', 'subdocument.body']
test.isUndefined SpecialPost.Meta.generators.subdocument.slug.reverseName
test.isUndefined SpecialPost.Meta.generators.subdocument.slug.reverseFields
test.instanceOf SpecialPost.Meta.generators.tags, SpecialPost._GeneratedField
test.equal SpecialPost.Meta.generators.tags.ancestorArray, 'tags'
test.isTrue _.isFunction SpecialPost.Meta.generators.tags.generator
test.equal SpecialPost.Meta.generators.tags.sourcePath, 'tags'
test.equal SpecialPost.Meta.generators.tags.sourceDocument, SpecialPost
test.equal SpecialPost.Meta.generators.tags.targetDocument, SpecialPost
test.equal SpecialPost.Meta.generators.tags.sourceCollection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.generators.tags.targetCollection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.generators.tags.sourceDocument.Meta.collection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.generators.tags.targetDocument.Meta.collection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.generators.tags.fields, ['body', 'subdocument.body', 'nested.body']
test.isUndefined SpecialPost.Meta.generators.tags.reverseName
test.isUndefined SpecialPost.Meta.generators.tags.reverseFields
test.equal _.size(SpecialPost.Meta.fields), 7
test.instanceOf SpecialPost.Meta.fields.author, SpecialPost._ReferenceField
test.isNull SpecialPost.Meta.fields.author.ancestorArray, SpecialPost.Meta.fields.author.ancestorArray
test.isTrue SpecialPost.Meta.fields.author.required
test.equal SpecialPost.Meta.fields.author.sourcePath, 'author'
test.equal SpecialPost.Meta.fields.author.sourceDocument, SpecialPost
test.equal SpecialPost.Meta.fields.author.targetDocument, Person
test.equal SpecialPost.Meta.fields.author.sourceCollection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.author.targetCollection._name, 'Persons'
test.equal SpecialPost.Meta.fields.author.sourceDocument.Meta.collection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.author.targetDocument.Meta.collection._name, 'Persons'
test.equal SpecialPost.Meta.fields.author.fields, ['username', 'displayName', 'field1', 'field2']
test.equal SpecialPost.Meta.fields.author.reverseName, 'posts'
test.equal SpecialPost.Meta.fields.author.reverseFields, ['body', 'subdocument.body', 'nested.body']
test.instanceOf SpecialPost.Meta.fields.subscribers, SpecialPost._ReferenceField
test.equal SpecialPost.Meta.fields.subscribers.ancestorArray, 'subscribers'
test.isTrue SpecialPost.Meta.fields.subscribers.required
test.equal SpecialPost.Meta.fields.subscribers.sourcePath, 'subscribers'
test.equal SpecialPost.Meta.fields.subscribers.sourceDocument, SpecialPost
test.equal SpecialPost.Meta.fields.subscribers.targetDocument, Person
test.equal SpecialPost.Meta.fields.subscribers.sourceCollection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.subscribers.targetCollection._name, 'Persons'
test.equal SpecialPost.Meta.fields.subscribers.sourceDocument.Meta.collection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.subscribers.targetDocument.Meta.collection._name, 'Persons'
test.equal SpecialPost.Meta.fields.subscribers.fields, []
test.isNull SpecialPost.Meta.fields.subscribers.reverseName
test.equal SpecialPost.Meta.fields.subscribers.reverseFields, []
test.instanceOf SpecialPost.Meta.fields.reviewers, SpecialPost._ReferenceField
test.equal SpecialPost.Meta.fields.reviewers.ancestorArray, 'reviewers'
test.isTrue SpecialPost.Meta.fields.reviewers.required
test.equal SpecialPost.Meta.fields.reviewers.sourcePath, 'reviewers'
test.equal SpecialPost.Meta.fields.reviewers.sourceDocument, SpecialPost
test.equal SpecialPost.Meta.fields.reviewers.targetDocument, Person
test.equal SpecialPost.Meta.fields.reviewers.sourceCollection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.reviewers.targetCollection._name, 'Persons'
test.equal SpecialPost.Meta.fields.reviewers.sourceDocument.Meta.collection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.reviewers.targetDocument.Meta.collection._name, 'Persons'
test.equal SpecialPost.Meta.fields.reviewers.fields, [username: 1]
test.isNull SpecialPost.Meta.fields.reviewers.reverseName
test.equal SpecialPost.Meta.fields.reviewers.reverseFields, []
test.equal _.size(SpecialPost.Meta.fields.subdocument), 2
test.instanceOf SpecialPost.Meta.fields.subdocument.person, SpecialPost._ReferenceField
test.isNull SpecialPost.Meta.fields.subdocument.person.ancestorArray, SpecialPost.Meta.fields.subdocument.person.ancestorArray
test.isFalse SpecialPost.Meta.fields.subdocument.person.required
test.equal SpecialPost.Meta.fields.subdocument.person.sourcePath, 'subdocument.person'
test.equal SpecialPost.Meta.fields.subdocument.person.sourceDocument, SpecialPost
test.equal SpecialPost.Meta.fields.subdocument.person.targetDocument, Person
test.equal SpecialPost.Meta.fields.subdocument.person.sourceCollection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.subdocument.person.targetCollection._name, 'Persons'
test.equal SpecialPost.Meta.fields.subdocument.person.sourceDocument.Meta.collection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.subdocument.person.targetDocument.Meta.collection._name, 'Persons'
test.equal SpecialPost.Meta.fields.subdocument.person.fields, {'username': 1, 'displayName': 1, 'field1': 1, 'field2': 1}
test.equal SpecialPost.Meta.fields.subdocument.person.reverseName, 'subdocument.posts'
test.equal SpecialPost.Meta.fields.subdocument.person.reverseFields, ['body', 'subdocument.body', 'nested.body']
test.instanceOf SpecialPost.Meta.fields.subdocument.persons, SpecialPost._ReferenceField
test.equal SpecialPost.Meta.fields.subdocument.persons.ancestorArray, 'subdocument.persons'
test.isTrue SpecialPost.Meta.fields.subdocument.persons.required
test.equal SpecialPost.Meta.fields.subdocument.persons.sourcePath, 'subdocument.persons'
test.equal SpecialPost.Meta.fields.subdocument.persons.sourceDocument, SpecialPost
test.equal SpecialPost.Meta.fields.subdocument.persons.targetDocument, Person
test.equal SpecialPost.Meta.fields.subdocument.persons.sourceCollection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.subdocument.persons.targetCollection._name, 'Persons'
test.equal SpecialPost.Meta.fields.subdocument.persons.sourceDocument.Meta.collection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.subdocument.persons.targetDocument.Meta.collection._name, 'Persons'
test.equal SpecialPost.Meta.fields.subdocument.persons.fields, ['username', 'displayName', 'field1', 'field2']
test.equal SpecialPost.Meta.fields.subdocument.persons.reverseName, 'subdocumentsPosts'
test.equal SpecialPost.Meta.fields.subdocument.persons.reverseFields, ['body', 'subdocument.body', 'nested.body']
test.equal _.size(SpecialPost.Meta.fields.nested), 3
test.instanceOf SpecialPost.Meta.fields.nested.required, SpecialPost._ReferenceField
test.equal SpecialPost.Meta.fields.nested.required.ancestorArray, 'nested'
test.isTrue SpecialPost.Meta.fields.nested.required.required
test.equal SpecialPost.Meta.fields.nested.required.sourcePath, 'nested.required'
test.equal SpecialPost.Meta.fields.nested.required.sourceDocument, SpecialPost
test.equal SpecialPost.Meta.fields.nested.required.targetDocument, Person
test.equal SpecialPost.Meta.fields.nested.required.sourceCollection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.nested.required.targetCollection._name, 'Persons'
test.equal SpecialPost.Meta.fields.nested.required.sourceDocument.Meta.collection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.nested.required.targetDocument.Meta.collection._name, 'Persons'
test.equal SpecialPost.Meta.fields.nested.required.fields, ['username', 'displayName', 'field1', 'field2']
test.equal SpecialPost.Meta.fields.nested.required.reverseName, 'nestedPosts'
test.equal SpecialPost.Meta.fields.nested.required.reverseFields, ['body', 'subdocument.body', 'nested.body']
test.instanceOf SpecialPost.Meta.fields.nested.optional, SpecialPost._ReferenceField
test.equal SpecialPost.Meta.fields.nested.optional.ancestorArray, 'nested'
test.isFalse SpecialPost.Meta.fields.nested.optional.required
test.equal SpecialPost.Meta.fields.nested.optional.sourcePath, 'nested.optional'
test.equal SpecialPost.Meta.fields.nested.optional.sourceDocument, SpecialPost
test.equal SpecialPost.Meta.fields.nested.optional.targetDocument, Person
test.equal SpecialPost.Meta.fields.nested.optional.sourceCollection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.nested.optional.targetCollection._name, 'Persons'
test.equal SpecialPost.Meta.fields.nested.optional.sourceDocument.Meta.collection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.nested.optional.targetDocument.Meta.collection._name, 'Persons'
test.equal SpecialPost.Meta.fields.nested.optional.fields, ['username']
test.isNull SpecialPost.Meta.fields.nested.optional.reverseName
test.equal SpecialPost.Meta.fields.nested.optional.reverseFields, []
test.instanceOf SpecialPost.Meta.fields.nested.slug, SpecialPost._GeneratedField
test.equal SpecialPost.Meta.fields.nested.slug.ancestorArray, 'nested'
test.isTrue _.isFunction SpecialPost.Meta.fields.nested.slug.generator
test.equal SpecialPost.Meta.fields.nested.slug.sourcePath, 'nested.slug'
test.equal SpecialPost.Meta.fields.nested.slug.sourceDocument, SpecialPost
test.equal SpecialPost.Meta.fields.nested.slug.targetDocument, SpecialPost
test.equal SpecialPost.Meta.fields.nested.slug.sourceCollection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.nested.slug.targetCollection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.nested.slug.sourceDocument.Meta.collection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.nested.slug.targetDocument.Meta.collection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.nested.slug.fields, ['body', 'nested.body']
test.isUndefined SpecialPost.Meta.fields.nested.slug.reverseName
test.isUndefined SpecialPost.Meta.fields.nested.slug.reverseFields
test.instanceOf SpecialPost.Meta.fields.slug, SpecialPost._GeneratedField
test.isNull SpecialPost.Meta.fields.slug.ancestorArray, SpecialPost.Meta.fields.slug.ancestorArray
test.isTrue _.isFunction SpecialPost.Meta.fields.slug.generator
test.equal SpecialPost.Meta.fields.slug.sourcePath, 'slug'
test.equal SpecialPost.Meta.fields.slug.sourceDocument, SpecialPost
test.equal SpecialPost.Meta.fields.slug.targetDocument, SpecialPost
test.equal SpecialPost.Meta.fields.slug.sourceCollection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.slug.targetCollection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.slug.sourceDocument.Meta.collection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.slug.targetDocument.Meta.collection._name, 'SpecialPosts'
test.equal SpecialPost.Meta.fields.slug.fields, ['body', 'subdocument.body']
test.isUndefined SpecialPost.Meta.fields.slug.reverseName
test.isUndefined SpecialPost.Meta.fields.slug.reverseFields
test.instanceOf SpecialPost.Meta.fields.special, SpecialPost._ReferenceField
test.isNull SpecialPost.Meta.fields.special.ancestorArray, SpecialPost.Meta.fields.special.ancestorArray
test.isTrue SpecialPost.Meta.fields.special.required
test.equal SpecialPost.Meta.fields.special.sourcePath, 'special'
test.equal SpecialPost.Meta.fields.special.sourceDocument, SpecialPost