@@ -9,15 +9,14 @@ const { read, rm, backup, restore } = require('../test-utils')
99const port = 7777
1010const serverUri = `https://tim.localhost:${ port } `
1111const root = path . join ( __dirname , '../resources/patch' )
12- const filePath = 'patch/tim.localhost'
1312const serverOptions = {
1413 serverUri,
1514 root,
1615 dbPath : path . join ( root , 'db' ) ,
1716 sslKey : path . join ( __dirname , '../keys/key.pem' ) ,
1817 sslCert : path . join ( __dirname , '../keys/cert.pem' ) ,
1918 webid : true ,
20- idp : true
19+ idp : false
2120}
2221const userCredentials = 'eyJhbGciOiJSUzI1NiIsImtpZCI6IkFWUzVlZk5pRUVNIn0.eyJpc3MiOiJodHRwczovL2xvY2FsaG9zdDo3Nzc3Iiwic3ViIjoiaHR0cHM6Ly90aW0ubG9jYWxob3N0Ojc3NzcvcHJvZmlsZS9jYXJkI21lIiwiYXVkIjoiN2YxYmU5YWE0N2JiMTM3MmIzYmM3NWU5MWRhMzUyYjQiLCJleHAiOjc3OTkyMjkwMDksImlhdCI6MTQ5MjAyOTAwOSwianRpIjoiZWY3OGQwYjY3ZWRjNzJhMSIsInNjb3BlIjoib3BlbmlkIHByb2ZpbGUifQ.H9lxCbNc47SfIq3hhHnj48BE-YFnvhCfDH9Jc4PptApTEip8sVj0E_u704K_huhNuWBvuv3cDRDGYZM7CuLnzgJG1BI75nXR9PYAJPK9Ketua2KzIrftNoyKNamGqkoCKFafF4z_rsmtXQ5u1_60SgWRcouXMpcHnnDqINF1JpvS21xjE_LbJ6qgPEhu3rRKcv1hpRdW9dRvjtWb9xu84bAjlRuT02lyDBHgj2utxpE_uqCbj48qlee3GoqWpGkSS-vJ6JA0aWYgnyv8fQsxf9rpdFNzKRoQO6XYMy6niEKj8aKgxjaUlpoGGJ5XtVLHH8AGwjYXR8iznYzJvEcB7Q'
2322
@@ -32,7 +31,7 @@ describe('PATCH', () => {
3231
3332 describe ( 'with an unsupported request content type' , ( ) => {
3433 it ( 'returns a 415' , ( ) =>
35- request . patch ( ` /read-write.ttl` )
34+ request . patch ( ' /read-write.ttl' )
3635 . set ( 'Authorization' , `Bearer ${ userCredentials } ` )
3736 . set ( 'Content-Type' , 'text/other' )
3837 . send ( 'other content type' )
@@ -45,7 +44,7 @@ describe('PATCH', () => {
4544
4645 describe ( 'with a patch document containing invalid syntax' , ( ) => {
4746 it ( 'returns a 400' , ( ) =>
48- request . patch ( ` /read-write.ttl` )
47+ request . patch ( ' /read-write.ttl' )
4948 . set ( 'Authorization' , `Bearer ${ userCredentials } ` )
5049 . set ( 'Content-Type' , 'text/n3' )
5150 . send ( 'invalid' )
@@ -58,7 +57,7 @@ describe('PATCH', () => {
5857
5958 describe ( 'with a patch document without relevant patch element' , ( ) => {
6059 it ( 'returns a 400' , ( ) =>
61- request . patch ( ` /read-write.ttl` )
60+ request . patch ( ' /read-write.ttl' )
6261 . set ( 'Authorization' , `Bearer ${ userCredentials } ` )
6362 . set ( 'Content-Type' , 'text/n3' )
6463 . send ( n3Patch ( `
@@ -73,7 +72,7 @@ describe('PATCH', () => {
7372
7473 describe ( 'with a patch document without insert and without deletes' , ( ) => {
7574 it ( 'returns a 400' , ( ) =>
76- request . patch ( ` /read-write.ttl` )
75+ request . patch ( ' /read-write.ttl' )
7776 . set ( 'Authorization' , `Bearer ${ userCredentials } ` )
7877 . set ( 'Content-Type' , 'text/n3' )
7978 . send ( n3Patch ( `
@@ -89,7 +88,7 @@ describe('PATCH', () => {
8988 describe ( 'appending' , ( ) => {
9089 describe ( 'to a resource with read-only access' , ( ) => {
9190 it ( 'returns a 403' , ( ) =>
92- request . patch ( ` /read-only.ttl` )
91+ request . patch ( ' /read-only.ttl' )
9392 . set ( 'Authorization' , `Bearer ${ userCredentials } ` )
9493 . set ( 'Content-Type' , 'text/n3' )
9594 . send ( n3Patch ( `
@@ -103,16 +102,16 @@ describe('PATCH', () => {
103102 )
104103
105104 it ( 'does not modify the file' , ( ) => {
106- assert . equal ( read ( ` ${ filePath } /read-only.ttl` ) ,
105+ assert . equal ( read ( 'patch /read-only.ttl' ) ,
107106 '<a> <b> <c>.\n' )
108107 } )
109108 } )
110109
111110 describe ( 'to a non-existing file' , ( ) => {
112- after ( ( ) => rm ( ` ${ filePath } /new.ttl` ) )
111+ after ( ( ) => rm ( 'patch /new.ttl' ) )
113112
114113 it ( 'returns a 200' , ( ) =>
115- request . patch ( ` /new.ttl` )
114+ request . patch ( ' /new.ttl' )
116115 . set ( 'Authorization' , `Bearer ${ userCredentials } ` )
117116 . set ( 'Content-Type' , 'text/n3' )
118117 . send ( n3Patch ( `
@@ -126,17 +125,17 @@ describe('PATCH', () => {
126125 )
127126
128127 it ( 'creates the file' , ( ) => {
129- assert . equal ( read ( ` ${ filePath } /new.ttl` ) ,
128+ assert . equal ( read ( 'patch /new.ttl' ) ,
130129 '@prefix : </new.ttl#>.\n@prefix tim: </>.\n\ntim:d tim:e tim:f.\n\n' )
131130 } )
132131 } )
133132
134133 describe ( 'to a resource with append access' , ( ) => {
135- before ( ( ) => backup ( ` ${ filePath } /append-only.ttl` ) )
136- after ( ( ) => restore ( ` ${ filePath } /append-only.ttl` ) )
134+ before ( ( ) => backup ( 'patch /append-only.ttl' ) )
135+ after ( ( ) => restore ( 'patch /append-only.ttl' ) )
137136
138137 it ( 'returns a 200' , ( ) =>
139- request . patch ( ` /append-only.ttl` )
138+ request . patch ( ' /append-only.ttl' )
140139 . set ( 'Authorization' , `Bearer ${ userCredentials } ` )
141140 . set ( 'Content-Type' , 'text/n3' )
142141 . send ( n3Patch ( `
@@ -150,17 +149,17 @@ describe('PATCH', () => {
150149 )
151150
152151 it ( 'patches the file' , ( ) => {
153- assert . equal ( read ( ` ${ filePath } /append-only.ttl` ) ,
152+ assert . equal ( read ( 'patch /append-only.ttl' ) ,
154153 '@prefix : </append-only.ttl#>.\n@prefix tim: </>.\n\ntim:a tim:b tim:c.\n\ntim:d tim:e tim:f.\n\n' )
155154 } )
156155 } )
157156
158157 describe ( 'to a resource with write access' , ( ) => {
159- before ( ( ) => backup ( ` ${ filePath } /write-only.ttl` ) )
160- after ( ( ) => restore ( ` ${ filePath } /write-only.ttl` ) )
158+ before ( ( ) => backup ( 'patch /write-only.ttl' ) )
159+ after ( ( ) => restore ( 'patch /write-only.ttl' ) )
161160
162161 it ( 'returns a 200' , ( ) =>
163- request . patch ( ` /write-only.ttl` )
162+ request . patch ( ' /write-only.ttl' )
164163 . set ( 'Authorization' , `Bearer ${ userCredentials } ` )
165164 . set ( 'Content-Type' , 'text/n3' )
166165 . send ( n3Patch ( `
@@ -174,7 +173,7 @@ describe('PATCH', () => {
174173 )
175174
176175 it ( 'patches the file' , ( ) => {
177- assert . equal ( read ( ` ${ filePath } /write-only.ttl` ) ,
176+ assert . equal ( read ( 'patch /write-only.ttl' ) ,
178177 '@prefix : </write-only.ttl#>.\n@prefix tim: </>.\n\ntim:a tim:b tim:c.\n\ntim:d tim:e tim:f.\n\n' )
179178 } )
180179 } )
0 commit comments