| Conditions | 1 |
| Paths | 1 |
| Total Lines | 38 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | var assert = require('chai').assert, |
||
| 4 | describe('AtomContent', function(){ |
||
| 5 | |||
| 6 | it('Create plain', function(){ |
||
| 7 | assert.instanceOf(new GedcomX.AtomContent(), GedcomX.AtomContent, 'An instance of AtomContent is not returned when calling the constructor with new.'); |
||
| 8 | assert.instanceOf(GedcomX.AtomContent(), GedcomX.AtomContent, 'An instance of AtomContent is not returned when calling the constructor without new.'); |
||
| 9 | }); |
||
| 10 | |||
| 11 | it('Create with JSON', function(){ |
||
| 12 | var content = GedcomX.AtomContent({ |
||
| 13 | gedcomx: { |
||
| 14 | description: '#root' |
||
| 15 | } |
||
| 16 | }); |
||
| 17 | assert.equal(content.getGedcomX().getDescription(), '#root'); |
||
| 18 | }); |
||
| 19 | |||
| 20 | it('Build', function(){ |
||
| 21 | var content = GedcomX.AtomContent() |
||
| 22 | .setGedcomX(GedcomX().setDescription('#root')); |
||
| 23 | assert.equal(content.getGedcomX().getDescription(), '#root'); |
||
| 24 | }); |
||
| 25 | |||
| 26 | it('toJSON', function(){ |
||
| 27 | var data = { |
||
| 28 | gedcomx: { |
||
| 29 | description: '#root' |
||
| 30 | } |
||
| 31 | }, content = GedcomX.AtomContent(data); |
||
| 32 | assert.deepEqual(content.toJSON(), data); |
||
| 33 | }); |
||
| 34 | |||
| 35 | it('constructor does not copy instances', function(){ |
||
| 36 | var obj1 = GedcomX.AtomContent(); |
||
| 37 | var obj2 = GedcomX.AtomContent(obj1); |
||
| 38 | assert.strictEqual(obj1, obj2); |
||
| 39 | }); |
||
| 40 | |||
| 41 | }); |