Completed
Push — master ( e3ee1d...5cbb1b )
by Justin
01:36
created

test/rs/PlaceReference.js   A

Complexity

Total Complexity 4
Complexity/F 1

Size

Lines of Code 39
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
c 1
b 0
f 0
nc 1
dl 0
loc 39
rs 10
wmc 4
mnd 0
bc 4
fnc 4
bpm 1
cpm 1
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
B PlaceReference.js ➔ describe(ꞌPlaceReferenceꞌ) 0 36 1
1
var assert = require('chai').assert,
2
    GedcomX = require('../../');
3
4
describe('PlaceReference', function(){
5
  
6
  it('Create with JSON', function(){
7
    var place = GedcomX.PlaceReference({
8
      "original": "Mitchel Field, Hempstead, New York, United States",
9
      "normalized":[
10
        {"lang": "en-US", "value": "Hempstead, Nassau, New York, United States"}
11
      ]
12
    });
13
    assert.equal(place.getOriginal(), 'Mitchel Field, Hempstead, New York, United States');
14
    assert.equal(place.getNormalized().length, 1);
15
    assert.equal(place.getNormalized()[0].getLang(), 'en-US');
16
    assert.equal(place.getNormalized()[0].getValue(), 'Hempstead, Nassau, New York, United States');
17
  });
18
  
19
  it('Build', function(){
20
    var place = GedcomX.PlaceReference()
21
      .setOriginal('Mitchel Field, Hempstead, New York, United States')
22
      .addNormalized({"lang": "en-US", "value": "Hempstead, Nassau, New York, United States"});
23
    assert.equal(place.getOriginal(), 'Mitchel Field, Hempstead, New York, United States');
24
    assert.equal(place.getNormalized().length, 1);
25
    assert.equal(place.getNormalized()[0].getLang(), 'en-US');
26
    assert.equal(place.getNormalized()[0].getValue(), 'Hempstead, Nassau, New York, United States');
27
  });
28
  
29
  it('toJSON', function(){
30
    var data = {
31
      "original": "Mitchel Field, Hempstead, New York, United States",
32
      "normalized":[
33
        {"lang": "en-US", "value": "Hempstead, Nassau, New York, United States"}
34
      ]
35
    }, place = GedcomX.PlaceReference(data);
36
    assert.deepEqual(place.toJSON(), data);
37
  });
38
  
39
});