@@ -5,23 +5,23 @@ var level = require("level-test")()
55
66describe ( "jsonld.put" , function ( ) {
77
8- var db
9- , manu = {
10- "@context" : {
11- "name" : "http://xmlns.com/foaf/0.1/name"
12- , "homepage" : {
13- "@id" : "http://xmlns.com/foaf/0.1/homepage"
14- , "@type" : "@id"
15- }
16- }
17- , "@id" : "http://manu.sporny.org#person"
18- , "name" : "Manu Sporny"
19- , "homepage" : "http://manu.sporny.org/"
20- }
8+ var db , manu ;
219
2210
2311 beforeEach ( function ( ) {
2412 db = jsonld ( graph ( level ( ) ) ) ;
13+ manu = manu = {
14+ "@context" : {
15+ "name" : "http://xmlns.com/foaf/0.1/name"
16+ , "homepage" : {
17+ "@id" : "http://xmlns.com/foaf/0.1/homepage"
18+ , "@type" : "@id"
19+ }
20+ }
21+ , "@id" : "http://manu.sporny.org#person"
22+ , "name" : "Manu Sporny"
23+ , "homepage" : "http://manu.sporny.org/"
24+ } ;
2525 } ) ;
2626
2727 afterEach ( function ( done ) {
@@ -81,7 +81,7 @@ describe("jsonld.put", function() {
8181 } ) ;
8282 } ) ;
8383
84- it ( "should generate a uuid for unknown objects" , function ( done ) {
84+ it ( "should generate an @id for unknown objects" , function ( done ) {
8585 delete manu [ "@id" ] ;
8686
8787 db . jsonld . put ( manu , { base : "http://levelgraph.org/tests/" } , function ( ) {
@@ -95,4 +95,13 @@ describe("jsonld.put", function() {
9595 } ) ;
9696 } ) ;
9797 } ) ;
98+
99+ it ( "should pass the generated @id to callback" , function ( done ) {
100+ delete manu [ "@id" ] ;
101+
102+ db . jsonld . put ( manu , { base : "http://levelgraph.org/tests/" } , function ( err , obj ) {
103+ expect ( obj [ "@id" ] . indexOf ( "http://levelgraph.org/tests/" ) ) . to . equal ( 0 ) ;
104+ done ( ) ;
105+ } ) ;
106+ } ) ;
98107} ) ;
0 commit comments