diff --git a/test/GedcomX.js b/test/GedcomX.js index d524bd9..1ec1f34 100644 --- a/test/GedcomX.js +++ b/test/GedcomX.js @@ -577,6 +577,17 @@ describe('GedcomX', function(){ assert.jsonSchema(gedx.toJSON(), GedcomXSchema); }); + it('adding Person does not copy', function(){ + var gedx = GedcomX(); + var person = GedcomX.Person({ + id: 'first' + }); + gedx.addPerson(person); + person.setId('second'); + assert.strictEqual(gedx.getPersons()[0], person, 'the added instance is not the same as the original instance'); + assert.deepEqual(gedx.getPersons()[0].toJSON(), person.toJSON(), 'serialization of the added person does not match the original person'); + }); + }); function tests(gedx){