| Total Complexity | 3 |
| Complexity/F | 1 |
| Lines of Code | 33 |
| Function Count | 3 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 | }); |