Completed
Pull Request — master (#13)
by Justin
01:38
created

rson does not copyꞌ)   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 10
rs 9.4285
1
var chai = require('chai');
2
chai.use(require('chai-json-schema'));
3
4
var assert = chai.assert,
5
    GedcomXSchema = require('gedcomx-json-schema'),
6
    GedcomX = require('../');
7
8
describe('GedcomX', function(){
9
  
10
  var fullJSON = {
11
    id: 'gedcomx',
12
    attribution: { 
13
      changeMessage: 'It changed',
14
      contributor: { resource: 'https://myapp.com/contributor'},
15
      created: 1111338494969,
16
      creator: { resource: 'https://myapp.com/creator'},
17
      modified: 1111338494969
18
    },
19
    persons: [
20
      {
21
        private: false,
22
        gender: {
23
          type: 'http://gedcomx.org/Female'
24
        },
25
        names: [
26
          {
27
            type: 'http://gedcomx.org/BirthName',
28
            nameForms: [
29
              {
30
                fullText: 'Joanna Hopkins'
31
              }
32
            ]
33
          }  
34
        ],
35
        facts: [
36
          {
37
            type: 'http://gedcomx.org/Birth',
38
            date: {
39
              formal: '+2001-04-09'
40
            },
41
            place: {
42
              original: 'Farm house'
43
            }
44
          }  
45
        ]
46
      } 
47
    ],
48
    relationships: [
49
      {
50
        type: 'http://gedcomx.org/Couple',
51
        person1: {
52
          resource: 'http://identifier/for/person/1'
53
        },
54
        person2: {
55
          resource: 'http://identifier/for/person/2'
56
        },
57
        facts: [
58
          {
59
            type: 'http://gedcomx.org/Marriage'
60
          }
61
        ]
62
      }  
63
    ],
64
    sourceDescriptions: [
65
      {
66
        resourceType: 'http://some/type',
67
        citations: [
68
          {
69
            lang: 'en',
70
            value: 'Long source citation'
71
          }
72
        ],
73
        mediaType: 'book',
74
        about: 'http://a/resource',
75
        mediator: {
76
          resource: 'http://mediator'
77
        },
78
        sources: [
79
          {
80
            description: 'http://source/reference'
81
          }
82
        ],
83
        analysis: {
84
          resource: 'http://analysis'
85
        },
86
        componentOf: {
87
          description: 'http://container'
88
        },
89
        titles: [
90
          {
91
            lang: 'en',
92
            value: 'Title'
93
          },
94
          {
95
            lang: 'es',
96
            value: 'Titulo'
97
          }
98
        ],
99
        notes: [
100
          {
101
            subject: 'Note',
102
            text: 'Some note text'
103
          }
104
        ],
105
        attribution: {
106
          created: 1234578129
107
        },
108
        rights: [
109
          {
110
            resource: 'https://some/right'
111
          }
112
        ],
113
        coverage: {
114
          temporal: {
115
            formal: '+2015'
116
          },
117
          spatial: {
118
            original: 'A place'
119
          }
120
        },
121
        descriptions: [
122
          {
123
            value: 'A description'
124
          }
125
        ],
126
        identifiers: {
127
          $: 'identifier'
128
        },
129
        created: 1000000,
130
        modified: 11111111,
131
        repository: {
132
          resource: 'http://repository'
133
        }
134
      }
135
    ],
136
    agents: [
137
      {
138
        id: 'agent',
139
        identifiers: {
140
          $: 'ident'
141
        },
142
        names: [
143
          {
144
            lang: 'en',
145
            value: 'Name'
146
          }  
147
        ],
148
        homepage: {
149
          resource: 'http://homepage'
150
        },
151
        openid: {
152
          resource: 'http://openid'
153
        },
154
        accounts: [
155
          {
156
            accountName: 'jimbo'
157
          }  
158
        ],
159
        emails: [
160
          {
161
            resource: 'http://email'
162
          }  
163
        ],
164
        phones: [
165
          {
166
            resource: 'http://phone'
167
          }  
168
        ],
169
        addresses: [
170
          {
171
            value: 'big long address',
172
            postalCode: '123456'
173
          }  
174
        ],
175
        person: {
176
          resource: 'http://person'
177
        }
178
      }  
179
    ],
180
    events: [
181
      {
182
        type: 'http://gedcomx.org/Marriage',
183
        date: {
184
          formal: '+2002-06-06'
185
        },
186
        place: {
187
          original: 'Her town, MN'
188
        },
189
        roles: [
190
          {
191
            person: {
192
              resource: 'http://groom'
193
            },
194
            type: 'http://gedcomx.org/Participant'
195
          }
196
        ]
197
      }  
198
    ],
199
    documents: [
200
      {
201
        type: 'http://gedcomx.org/Abstract',
202
        extracted: false,
203
        textType: 'plain',
204
        text: 'Lots of text',
205
        attribution: {
206
          created: 123456789
207
        }
208
      }  
209
    ],
210
    places: [
211
      {
212
        names : [ 
213
          {
214
            lang : 'en',
215
            value : 'Pope\'s Creek, Westmoreland, Virginia, United States'
216
          }
217
        ],
218
        type : 'http://identifier/for/the/place/type',
219
        place : { resource : 'http://place' },
220
        jurisdiction : { resource : 'http://jurisdiction' },
221
        latitude : 27.9883575,
222
        longitude : 86.9252014,
223
        temporalDescription : { 
224
          formal: '+1899-01-04'
225
        },
226
        spatialDescription : {
227
          resource : 'http://uri/for/KML/document'
228
        }
229
      }
230
    ]
231
  };
232
  
233
  it('Create plain', function(){
234
    var newGedx = new GedcomX(),
235
        gedx = GedcomX();
236
    assert.instanceOf(newGedx, GedcomX, 'An instance of GedcomX is not returned when calling the constructor with new.');
237
    assert.instanceOf(gedx, GedcomX, 'An instance of GedcomX is not returned when calling the constructor without new.');
238
    assert.jsonSchema(newGedx.toJSON(), GedcomXSchema);
239
    assert.jsonSchema(gedx.toJSON(), GedcomXSchema);
240
  });
241
  
242
  it('Create with JSON', function(){
243
    var gedx = GedcomX(fullJSON);
244
    tests(gedx);
245
  });
246
  
247
  it('Create with mixed data', function(){
248
    var gedx = GedcomX({
249
      id: 'gedcomx',
250
      attribution: GedcomX.Attribution({ 
251
        changeMessage: 'It changed',
252
        contributor: GedcomX.ResourceReference({ resource: 'https://myapp.com/contributor'}),
253
        created: new Date(1111338494969),
254
        creator: GedcomX.ResourceReference({ resource: 'https://myapp.com/creator'}),
255
        modified: new Date(1111338494969)
256
      }),
257
      persons: [
258
        GedcomX.Person({
259
          gender: {
260
            type: 'http://gedcomx.org/Female'
261
          },
262
          names: [
263
            {
264
              type: 'http://gedcomx.org/BirthName',
265
              nameForms: [
266
                {
267
                  fullText: 'Joanna Hopkins'
268
                }
269
              ]
270
            }  
271
          ],
272
          facts: [
273
            {
274
              type: 'http://gedcomx.org/Birth',
275
              date: {
276
                formal: '+2001-04-09'
277
              },
278
              place: {
279
                original: 'Farm house'
280
              }
281
            }  
282
          ]
283
        })
284
      ],
285
      relationships: [
286
        GedcomX.Relationship({
287
          type: 'http://gedcomx.org/Couple',
288
          person1: {
289
            resource: 'http://identifier/for/person/1'
290
          },
291
          person2: {
292
            resource: 'http://identifier/for/person/2'
293
          },
294
          facts: [
295
            GedcomX.Fact({
296
              type: 'http://gedcomx.org/Marriage'
297
            })
298
          ]
299
        })  
300
      ],
301
      sourceDescriptions: [
302
        GedcomX.SourceDescription({
303
          resourceType: 'http://some/type',
304
          citations: [
305
            GedcomX.SourceCitation({
306
              lang: 'en',
307
              value: 'Long source citation'
308
            })
309
          ],
310
          mediaType: 'book',
311
          about: 'http://a/resource',
312
          mediator: {
313
            resource: 'http://mediator'
314
          },
315
          sources: [
316
            GedcomX.SourceReference({
317
              description: 'http://source/reference'
318
            })
319
          ],
320
          analysis: {
321
            resource: 'http://analysis'
322
          },
323
          componentOf: {
324
            description: 'http://container'
325
          },
326
          titles: [
327
            GedcomX.TextValue({
328
              lang: 'en',
329
              value: 'Title'
330
            }),
331
            {
332
              lang: 'es',
333
              value: 'Titulo'
334
            }
335
          ],
336
          notes: [
337
            GedcomX.Note({
338
              subject: 'Note',
339
              text: 'Some note text'
340
            })
341
          ],
342
          attribution: {
343
            created: 1234578129
344
          },
345
          rights: [
346
            GedcomX.ResourceReference({
347
              resource: 'https://some/right'
348
            })
349
          ],
350
          coverage: GedcomX.Coverage({
351
            temporal: {
352
              formal: '+2015'
353
            },
354
            spatial: {
355
              original: 'A place'
356
            }
357
          }),
358
          descriptions: [
359
            {
360
              value: 'A description'
361
            }
362
          ],
363
          identifiers: {
364
            $: 'identifier'
365
          },
366
          created: 1000000,
367
          modified: 11111111,
368
          repository: GedcomX.ResourceReference({
369
            resource: 'http://repository'
370
          })
371
        })  
372
      ],
373
      agents: [
374
        GedcomX.Agent({
375
          id: 'agent',
376
          identifiers: GedcomX.Identifiers({
377
            $: 'ident'
378
          }),
379
          names: [
380
            GedcomX.TextValue({
381
              lang: 'en',
382
              value: 'Name'
383
            })
384
          ],
385
          homepage: GedcomX.ResourceReference({
386
            resource: 'http://homepage'
387
          }),
388
          openid: GedcomX.ResourceReference({
389
            resource: 'http://openid'
390
          }),
391
          accounts: [
392
            GedcomX.OnlineAccount({
393
              accountName: 'jimbo'
394
            })
395
          ],
396
          emails: [
397
            GedcomX.ResourceReference({
398
              resource: 'http://email'
399
            })
400
          ],
401
          phones: [
402
            GedcomX.ResourceReference({
403
              resource: 'http://phone'
404
            })
405
          ],
406
          addresses: [
407
            GedcomX.Address({
408
              value: 'big long address',
409
              postalCode: '123456'
410
            })
411
          ],
412
          person: GedcomX.ResourceReference({
413
            resource: 'http://person'
414
          })
415
        })  
416
      ],
417
      events: [
418
        GedcomX.Event({
419
          type: 'http://gedcomx.org/Marriage',
420
          date: GedcomX.Date({
421
            formal: '+2002-06-06'
422
          }),
423
          place: GedcomX.PlaceReference({
424
            original: 'Her town, MN'
425
          }),
426
          roles: [
427
            GedcomX.EventRole({
428
              person: {
429
                resource: 'http://groom'
430
              },
431
              type: 'http://gedcomx.org/Participant'
432
            })
433
          ]
434
        })  
435
      ],
436
      documents: [
437
        GedcomX.Document({
438
          type: 'http://gedcomx.org/Abstract',
439
          extracted: false,
440
          textType: 'plain',
441
          text: 'Lots of text',
442
          attribution: GedcomX.Attribution({
443
            created: 123456789
444
          })
445
        })
446
      ],
447
      places: [
448
        GedcomX.PlaceDescription({
449
          names : [ 
450
            GedcomX.TextValue({
451
              lang : 'en',
452
              value : 'Pope\'s Creek, Westmoreland, Virginia, United States'
453
            })
454
          ],
455
          type : 'http://identifier/for/the/place/type',
456
          place : GedcomX.ResourceReference({ resource : 'http://place' }),
457
          jurisdiction : GedcomX.ResourceReference({ resource : 'http://jurisdiction' }),
458
          latitude : 27.9883575,
459
          longitude : 86.9252014,
460
          temporalDescription : GedcomX.Date({ 
461
            formal: '+1899-01-04'
462
          }),
463
          spatialDescription : GedcomX.ResourceReference({
464
            resource : 'http://uri/for/KML/document'
465
          })
466
        })  
467
      ]
468
    });
469
    
470
    tests(gedx);
471
  });
472
  
473
  it('Build', function(){
474
    var gedx = GedcomX()
475
      .setId('gedcomx')
476
      .setAttribution(GedcomX.Attribution()
477
        .setChangeMessage('It changed')
478
        .setContributor({ resource: 'https://myapp.com/contributor'})
479
        .setCreated(1111338494969)
480
        .setCreator({ resource: 'https://myapp.com/creator'})
481
        .setModified(1111338494969))
482
      .addPerson(
483
        GedcomX.Person()
484
          .setId('testPerson')
485
          .setPrivate(true)
486
          .setGender(GedcomX.Gender().setType('http://gedcomx.org/Female'))
487
          .addName(GedcomX.Name().addNameForm(GedcomX.NameForm().setFullText('Joanna Hopkins')))
488
          .addFact(GedcomX.Fact().setDate(GedcomX.Date().setFormal('+2001-04-09')).setPlace(GedcomX.PlaceReference().setOriginal('Farm house')))
489
      )
490
      .addRelationship(
491
        GedcomX.Relationship()
492
          .setType('http://gedcomx.org/Couple')
493
          .setPerson1(GedcomX.ResourceReference().setResource('http://identifier/for/person/1'))
494
          .setPerson2(GedcomX.ResourceReference().setResource('http://identifier/for/person/2'))
495
          .addFact(GedcomX.Fact().setType('http://gedcomx.org/Marriage'))  
496
      )
497
      .addSourceDescription(
498
        GedcomX.SourceDescription()
499
          .setResourceType('http://some/type')
500
          .addCitation(GedcomX.SourceCitation().setLang('en').setValue('Long source citation'))
501
          .setMediaType('book')
502
          .setAbout('http://a/resource')
503
          .setMediator(GedcomX.ResourceReference().setResource('http://mediator'))
504
          .addSource(GedcomX.SourceReference().setDescription('http://source/reference'))
505
          .setAnalysis(GedcomX.ResourceReference().setResource('http://analysis'))
506
          .setComponentOf(GedcomX.SourceReference().setDescription('http://container'))
507
          .addTitle(GedcomX.TextValue().setLang('en').setValue('Title'))
508
          .addTitle(GedcomX.TextValue().setLang('es').setValue('Titulo'))
509
          .addNote(GedcomX.Note().setSubject('Note').setText('Some note text'))
510
          .setAttribution(GedcomX.Attribution().setCreated(1234578129))
511
          .addRight(GedcomX.ResourceReference().setResource('https://some/right'))
512
          .setCoverage(
513
            GedcomX.Coverage()
514
              .setTemporal(GedcomX.Date().setFormal('+2015'))
515
              .setSpatial(GedcomX.PlaceReference().setOriginal('A place'))
516
          )
517
          .addDescription(GedcomX.TextValue().setValue('A description'))
518
          .setIdentifiers(GedcomX.Identifiers({
519
            $: 'identifier'
520
          }))
521
          .setCreated(1000000)
522
          .setModified(11111111)
523
          .setRepository(GedcomX.ResourceReference().setResource('http://repository'))  
524
      )
525
      .addAgent(
526
        GedcomX.Agent()
527
          .setId('agent')
528
          .setIdentifiers(GedcomX.Identifiers({$:'ident'}))
529
          .addName(GedcomX.TextValue().setLang('en').setValue('Name'))
530
          .setHomepage(GedcomX.ResourceReference().setResource('http://homepage'))
531
          .setOpenid(GedcomX.ResourceReference().setResource('http://openid'))
532
          .addAccount(GedcomX.OnlineAccount().setAccountName('jimbo'))
533
          .addEmail(GedcomX.ResourceReference().setResource('http://email'))
534
          .addPhone(GedcomX.ResourceReference().setResource('http://phone'))
535
          .addAddress(GedcomX.Address().setValue('big long address').setPostalCode('123456'))
536
          .setPerson(GedcomX.ResourceReference().setResource('http://person'))  
537
      )
538
      .addEvent(
539
        GedcomX.Event()
540
          .setType('http://gedcomx.org/Marriage')
541
          .setDate(GedcomX.Date().setFormal('+2002-06-06'))
542
          .setPlace(GedcomX.PlaceReference().setOriginal('Her town, MN'))
543
          .addRole(GedcomX.EventRole()
544
            .setType('http://gedcomx.org/Participant')
545
            .setPerson(GedcomX.ResourceReference().setResource('http://groom')))  
546
      )
547
      .addDocument(
548
        GedcomX.Document()
549
        .setType('http://gedcomx.org/Abstract')
550
        .setExtracted(false)
551
        .setTextType('plain')
552
        .setText('Lots of text')
553
        .setAttribution(GedcomX.Attribution().setCreated(123456789))          
554
      )
555
      .addPlace(
556
        GedcomX.PlaceDescription()
557
          .addName(GedcomX.TextValue().setLang('en').setValue('Pope\'s Creek, Westmoreland, Virginia, United States'))
558
          .setType('http://identifier/for/the/place/type')
559
          .setPlace(GedcomX.ResourceReference({ resource : 'http://place' }))
560
          .setJurisdiction(GedcomX.ResourceReference({ resource : 'http://jurisdiction' }))
561
          .setLatitude(27.9883575)
562
          .setLongitude(86.9252014)
563
          .setTemporalDescription(GedcomX.Date({ 
564
            formal: '+1899-01-04'
565
          }))
566
          .setSpatialDescription(GedcomX.ResourceReference({
567
            resource : 'http://uri/for/KML/document'
568
          }))
569
      );
570
    
571
    tests(gedx);
572
  });
573
  
574
  it('toJSON', function(){
575
    var gedx = GedcomX(fullJSON);
576
    assert.deepEqual(gedx.toJSON(), fullJSON);
577
    assert.jsonSchema(gedx.toJSON(), GedcomXSchema);
578
  });
579
  
580
  it('adding Person does not copy', function(){
581
    var gedx = GedcomX();
582
    var person = GedcomX.Person({
583
      id: 'first'
584
    });
585
    gedx.addPerson(person);
586
    person.setId('second');
587
    assert.strictEqual(gedx.getPersons()[0], person, 'the added instance is not the same as the original instance');
588
    assert.deepEqual(gedx.getPersons()[0].toJSON(), person.toJSON(), 'serialization of the added person does not match the original person');
589
  });
590
  
591
});
592
593
function tests(gedx){
594
  assert.equal(gedx.getId(), 'gedcomx');
595
  
596
  var attribution = gedx.getAttribution();
597
  assert.equal(attribution.getChangeMessage(), 'It changed', 'Change message not saved properly when created with JSON');
598
  assert.equal(attribution.getContributor().getResource(), 'https://myapp.com/contributor', 'Contributor not saved when created with JSON');
599
  assert.equal(attribution.getCreated().getTime(), 1111338494969, 'Created date not saved when created with JSON');
600
  assert.equal(attribution.getCreator().getResource(), 'https://myapp.com/creator', 'Creator not saved when created with JSON');
601
  assert.equal(attribution.getModified().getTime(), 1111338494969, 'Modified date not saved when created with JSON');
602
  
603
  assert.equal(gedx.getPersons().length, 1);
604
  var person = gedx.getPersons()[0];
605
  assert.equal(person.getGender().getType(), 'http://gedcomx.org/Female');
606
  assert.equal(person.getNames().length, 1);
607
  assert.equal(person.getFacts().length, 1);
608
  
609
  assert.equal(gedx.getRelationships().length, 1);
610
  var relationship = gedx.getRelationships()[0];
611
  assert.equal(relationship.getType(), 'http://gedcomx.org/Couple');
612
  assert.equal(relationship.getPerson1().getResource(), 'http://identifier/for/person/1');
613
  assert.equal(relationship.getPerson2().getResource(), 'http://identifier/for/person/2');
614
  assert.equal(relationship.getFacts().length, 1);
615
  assert.equal(relationship.getFacts()[0].getType(), 'http://gedcomx.org/Marriage');
616
  
617
  assert.equal(gedx.getSourceDescriptions().length, 1);
618
  var description = gedx.getSourceDescriptions()[0];
619
  assert.equal(description.getResourceType(), 'http://some/type');
620
  assert.equal(description.getCitations().length, 1);
621
  assert.equal(description.getCitations()[0].getLang(), 'en');
622
  assert.equal(description.getCitations()[0].getValue(), 'Long source citation');
623
  assert.equal(description.getMediaType(), 'book');
624
  assert.equal(description.getAbout(), 'http://a/resource');
625
  assert.equal(description.getMediator().getResource(), 'http://mediator');
626
  assert.equal(description.getSources().length, 1);
627
  assert.equal(description.getSources()[0].getDescription(), 'http://source/reference');
628
  assert.equal(description.getAnalysis().getResource(), 'http://analysis');
629
  assert.equal(description.getComponentOf().getDescription(), 'http://container');
630
  assert.equal(description.getTitles().length, 2);
631
  assert.equal(description.getTitles()[0].getLang(), 'en');
632
  assert.equal(description.getTitles()[0].getValue(), 'Title');
633
  assert.equal(description.getTitles()[1].getLang(), 'es');
634
  assert.equal(description.getTitles()[1].getValue(), 'Titulo');
635
  assert.equal(description.getNotes().length, 1);
636
  assert.equal(description.getNotes()[0].getSubject(), 'Note');
637
  assert.equal(description.getNotes()[0].getText(), 'Some note text');
638
  assert.equal(description.getAttribution().getCreated().getTime(), 1234578129);
639
  assert.equal(description.getRights().length, 1);
640
  assert.equal(description.getRights()[0].getResource(), 'https://some/right');
641
  assert.equal(description.getCoverage().getTemporal().getFormal(), '+2015');
642
  assert.equal(description.getCoverage().getSpatial().getOriginal(), 'A place');
643
  assert.equal(description.getDescriptions().length, 1);
644
  assert.equal(description.getDescriptions()[0].getValue(), 'A description');
645
  assert.equal(description.getIdentifiers().identifiers.$, 'identifier');
646
  assert.equal(description.getCreated(), 1000000);
647
  assert.equal(description.getModified(), 11111111);
648
  assert.equal(description.getRepository().getResource(), 'http://repository');
649
  
650
  assert.equal(gedx.getAgents().length, 1);
651
  var agent = gedx.getAgents()[0];
652
  assert.equal(agent.getId(), 'agent');
653
  assert.equal(agent.getIdentifiers().identifiers.$, 'ident');
654
  assert.equal(agent.getNames().length, 1);
655
  assert.equal(agent.getNames()[0].getLang(), 'en');
656
  assert.equal(agent.getNames()[0].getValue(), 'Name');
657
  assert.equal(agent.getHomepage().getResource(), 'http://homepage');
658
  assert.equal(agent.getOpenid().getResource(), 'http://openid');
659
  assert.equal(agent.getAccounts().length, 1);
660
  assert.equal(agent.getAccounts()[0].getAccountName(), 'jimbo');
661
  assert.equal(agent.getEmails().length, 1);
662
  assert.equal(agent.getEmails()[0].getResource(), 'http://email');
663
  assert.equal(agent.getPhones().length, 1);
664
  assert.equal(agent.getPhones()[0].getResource(), 'http://phone');
665
  assert.equal(agent.getAddresses().length, 1);
666
  assert.equal(agent.getAddresses()[0].getValue(), 'big long address');
667
  assert.equal(agent.getAddresses()[0].getPostalCode(), '123456');
668
  assert.equal(agent.getPerson().getResource(), 'http://person');
669
  
670
  assert.equal(gedx.getEvents().length, 1);
671
  var event = gedx.getEvents()[0];
672
  assert.equal(event.getType(), 'http://gedcomx.org/Marriage');
673
  assert.equal(event.getDate().getFormal(), '+2002-06-06');
674
  assert.equal(event.getPlace().getOriginal(), 'Her town, MN');
675
  assert.equal(event.getRoles().length, 1);
676
  assert.equal(event.getRoles()[0].getPerson().getResource(), 'http://groom');
677
  assert.equal(event.getRoles()[0].getType(), 'http://gedcomx.org/Participant');
678
  
679
  assert.equal(gedx.getDocuments().length, 1);
680
  var doc = gedx.getDocuments()[0];
681
  assert.equal(doc.getType(), 'http://gedcomx.org/Abstract');
682
  assert.equal(doc.getExtracted(), false);
683
  assert.equal(doc.getTextType(), 'plain');
684
  assert.equal(doc.getText(), 'Lots of text');
685
  assert.equal(doc.getAttribution().getCreated().getTime(), 123456789);
686
  
687
  assert.equal(gedx.getPlaces().length, 1);
688
  var place = gedx.getPlaces()[0];
689
  assert.equal(place.getNames().length, 1);
690
  assert.equal(place.getNames()[0].getLang(), 'en');
691
  assert.equal(place.getNames()[0].getValue(), 'Pope\'s Creek, Westmoreland, Virginia, United States');
692
  assert.equal(place.getType(), 'http://identifier/for/the/place/type');
693
  assert.equal(place.getPlace().getResource(), 'http://place');
694
  assert.equal(place.getJurisdiction().getResource(), 'http://jurisdiction');
695
  assert.equal(place.getLatitude(), 27.9883575);
696
  assert.equal(place.getLongitude(), 86.9252014);
697
  assert.equal(place.getTemporalDescription().getFormal(), '+1899-01-04');
698
  assert.equal(place.getSpatialDescription().getResource(), 'http://uri/for/KML/document');
699
  
700
  assert.jsonSchema(gedx.toJSON(), GedcomXSchema);
701
}