From ff72fc0224387724e1e6874af55c03d863767281 Mon Sep 17 00:00:00 2001 From: Jun Matsushita Date: Fri, 13 Jan 2017 19:03:56 +0100 Subject: [PATCH 1/2] Failing test for #47 --- test/put_spec.js | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/test/put_spec.js b/test/put_spec.js index 148f886..70ef4b0 100644 --- a/test/put_spec.js +++ b/test/put_spec.js @@ -331,9 +331,11 @@ describe('jsonld.put with default base', function() { }); }); - it('should insert graphs', function(done) { + it('should insert graphs yo', function(done) { var library = helper.getFixture('library.json'); + console.log(library) + db.jsonld.put(library, function() { db.get({}, function(err, triples) { expect(triples).to.have.length(9); @@ -616,4 +618,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(); + }); + }); + }); + }); }); From 7144177a37a8cc49fae355b5c450de806b801a12 Mon Sep 17 00:00:00 2001 From: Jun Matsushita Date: Fri, 13 Jan 2017 19:06:54 +0100 Subject: [PATCH 2/2] Be polite yo --- test/put_spec.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/put_spec.js b/test/put_spec.js index 70ef4b0..a340c08 100644 --- a/test/put_spec.js +++ b/test/put_spec.js @@ -331,11 +331,9 @@ describe('jsonld.put with default base', function() { }); }); - it('should insert graphs yo', function(done) { + it('should insert graphs', function(done) { var library = helper.getFixture('library.json'); - console.log(library) - db.jsonld.put(library, function() { db.get({}, function(err, triples) { expect(triples).to.have.length(9);