Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.

Commit b726e52

Browse files
committed
bump solid-rest and rdflib versions
1 parent aa6feb0 commit b726e52

File tree

4 files changed

+117
-83
lines changed

4 files changed

+117
-83
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "solid-auth-cli",
3-
"version": "1.0.8",
3+
"version": "1.0.9",
44
"main": "src/index.js",
55
"author": "Jeff Zucker",
66
"license": "MIT",
@@ -13,9 +13,9 @@
1313
"cross-fetch": "^3.0.4",
1414
"jsonld": "^1.4.0",
1515
"n3": "^1.0.3",
16-
"solid-rest": "^1.0.7"
16+
"solid-rest": "^1.0.8"
1717
},
1818
"devDependencies": {
19-
"rdflib": "^0.20.1"
19+
"rdflib": "^1.0.6"
2020
}
2121
}

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const client = new SolidClient({ identityManager : new IdentityManager() });
3535

3636
/*cjs*/ async function fetch(url,request){
3737
if( url.match(/^(file:|app:)/) ){
38-
setRestHandlers()
38+
if(typeof(rest)==="undefined") setRestHandlers()
3939
return await rest.fetch(url,request)
4040
}
4141
request = request || {};

tests/all.js

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -55,75 +55,81 @@ async function getConfig(scheme){
5555

5656
async function run(scheme){
5757

58+
5859
[tests,fails,passes] = [0,0,0]
5960
let cfg = await getConfig(scheme)
61+
let res
6062

61-
if(scheme==="app:") await postFolder("app://ls/","test-folder")
63+
/* CREATE TEST FOLDER ON APP */
64+
if(scheme==="app:") {
65+
res = await postFolder("app://ls/","test-folder")
66+
cfg.base += "/";
67+
}
6268

6369
console.log(`\nTesting ${cfg.base} ...`)
6470

6571
res = await postFolder( cfg.base,cfg.c1name )
66-
ok( "400 post container with trailing slash on slug", res.status==400)
72+
ok( "400 post container with trailing slash on slug", res.status==400,res)
6773

6874
cfg.c1name = cfg.c1name.replace(/\/$/,'')
6975

7076
res = await postFolder( cfg.base,cfg.c1name )
71-
ok( "201 post container", res.status==201)
77+
ok( "201 post container", res.status==201,res)
7278

7379
res = await postFolder( cfg.base,cfg.c1name )
74-
ok( "201 post container, container found", res.status==201)
80+
ok( "201 post container, container found", res.status==201,res)
7581

7682
res = await postFolder( cfg.missingFolder,cfg.c2name )
77-
ok( "404 post container, parent not found", res.status==404)
83+
ok( "404 post container, parent not found", res.status==404,res)
7884

7985
res = await postFile( cfg.folder1,cfg.r1name,cfg.text )
80-
ok( "201 post resource", res.status==201)
86+
ok( "201 post resource", res.status==201,res)
8187

8288
res = await postFile( cfg.folder1,cfg.r1name,cfg.txt )
83-
ok( "201 post resource, resource found", res.status==201)
89+
ok( "201 post resource, resource found", res.status==201,res)
8490

8591
res = await postFile( cfg.missingFolder,cfg.file2 )
86-
ok( "404 post resource, parent not found", res.status==404)
92+
ok( "404 post resource, parent not found", res.status==404,res)
8793

8894
res = await PUT( cfg.folder1 )
89-
ok( "409 put container (method not allowed)", res.status==409)
95+
ok( "409 put container (method not allowed)", res.status==409,res)
9096

9197
res = await PUT( cfg.file1,cfg.text )
92-
ok( "201 put resource", res.status==201)
98+
ok( "201 put resource", res.status==201,res)
9399

94100
res = await PUT( cfg.file1,cfg.text )
95-
ok( "201 put resource, resource found", res.status==201)
101+
ok( "201 put resource, resource found", res.status==201,res)
96102

97103
res = await PUT( cfg.deepR,cfg.text )
98104
ok("201 put resource, parent not found (recursive creation)",res.status==201)
99105

100106
res = await HEAD( cfg.deepR )
101-
ok("200 head",res.status==200 && res.headers.get("allow") )
107+
ok("200 head",res.status==200 && res.headers.get("allow"),res )
102108

103109
res = await HEAD( cfg.missingFolder )
104-
ok("404 head resource, not found",res.status==404 )
110+
ok("404 head resource, not found",res.status==404,res )
105111

106112
res = await GET( cfg.missingFolder )
107-
ok("404 get container, not found",res.status==404 )
113+
ok("404 get container, not found",res.status==404,res )
108114

109115
res = await GET( cfg.file1 )
110116
ok("200 get resource",res.status==200 && await res.text()===cfg.text)
111117

112118
res = await GET( cfg.folder1 )
113119
let type = res.headers.get("content-type")
114-
ok("200 get container",res.status==200 && type==="text/turtle")
120+
ok("200 get container",res.status==200 && type==="text/turtle",res)
115121

116122
res = await DELETE( cfg.folder1 )
117-
ok("409 delete container, not empty",res.status==409)
123+
ok("409 delete container, not empty",res.status==409,res)
118124

119125
res = await DELETE( cfg.file1 )
120126
res = await DELETE( cfg.deepR )
121-
ok("200 delete resource",res.status==200)
127+
ok("200 delete resource",res.status==200,res)
122128

123129
if(scheme != "https:"){
124130
res = await DELETE( cfg.folder2 )
125131
res = await DELETE( cfg.folder1 )
126-
ok("200 delete container",res.status==200)
132+
ok("200 delete container",res.status==200,res)
127133
}
128134

129135
console.log(`${passes}/${tests} tests passed, ${fails} failed\n`)
@@ -139,15 +145,15 @@ async function HEAD(url){
139145
return await fetch( url, {method:"HEAD"} )
140146
}
141147
async function PUT(url,text){
142-
return await fetch( url, {method:"PUT",body:text} )
148+
return await fetch( url, {method:"PUT",body:text,headers:{"content-type":"text/turtle"}} )
143149
}
144150
async function DELETE(url){
145151
return await fetch( url, {method:"DELETE"} )
146152
}
147153
async function POST(parent,item,content,link){
148154
return await fetch( parent,{
149155
method:"POST",
150-
headers:{slug:item,link:link},
156+
headers:{slug:item,link:link,"content-type":"text/turtle"},
151157
body:content
152158
})
153159
}
@@ -162,12 +168,13 @@ async function postFolder(parent,folder){
162168

163169
/* ============================================== */
164170

165-
function ok( label, success ){
171+
function ok( label, success,res ){
166172
tests = tests + 1;
167173
if(success) passes = passes + 1
168174
else fails = fails+1
169175
let msg = success ? "ok " : "FAIL "
170176
console.log( " " + msg + label)
177+
if(!success && res ) console.log(res.status,res.statusText)
171178
return success
172179
}
173180

0 commit comments

Comments
 (0)