diff --git a/test/put_spec.js b/test/put_spec.js index 148f886..a340c08 100644 --- a/test/put_spec.js +++ b/test/put_spec.js @@ -616,4 +616,31 @@ describe('jsonld.put with base and preserve option', function() { }); }); + it('should insert not overwrite existing node with a blank node', function(done) { + var existing = {"@context": { "@vocab": "https://schema.org/"}, "@id": "http://bigbluehat.com/#", "name": "BigBlueHat"}; + var blank = {"@context": { "@vocab": "https://schema.org/"}, "name": "BigBlueHat"}; + + db.jsonld.put(existing, function() { + db.jsonld.put(blank, function() { + db.get({}, function(err, triples) { + expect(triples).to.have.length(2); + done(); + }); + }); + }); + }); + + it('should accept @context strings', function(done) { + var existing = {"@context": "https://schema.org/", "@id": "http://bigbluehat.com/#", "name": "BigBlueHat"}; + var blank = {"@context": "https://schema.org/", "name": "BigBlueHat"}; + + db.jsonld.put(existing, function() { + db.jsonld.put(blank, function() { + db.get({}, function(err, triples) { + expect(triples).to.have.length(2); + done(); + }); + }); + }); + }); });