test/rs/ExtensibleData.js   A
last analyzed

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 33
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

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

1 Function

Rating   Name   Duplication   Size   Complexity  
B ExtensibleData.js ➔ describe(ꞌExtensibleDataꞌ) 0 30 1
1
var assert = require('chai').assert,
2
    GedcomX = require('../../');
3
4
describe('ExtensibleData', function(){
5
6
  it('Create with JSON', function(){
7
    var ed = GedcomX.ExtensibleData({ 
8
      id: 'edid',
9
      links: {
10
        person: {
11
          href: '/person'
12
        }
13
      }
14
    });
15
    assert.equal(ed.getId(), 'edid', 'ID not saved properly when created with JSON');
16
    assert.equal(ed.getLinks().length, 1);
17
    assert.equal(ed.getLinks()[0].getHref(), '/person');
18
    assert.equal(ed.getLink('person').getHref(), '/person');
19
  });
20
  
21
  it('toJSON()', function(){
22
    var json = { 
23
      id: 'edid',
24
      links: {
25
        person: {
26
          href: '/person'
27
        }
28
      }
29
    }, ed = GedcomX.ExtensibleData(json);
30
    assert.deepEqual(ed.toJSON(), json, 'JSON export is incorrect');
31
  });
32
  
33
});