Skip to content

Commit 0d59524

Browse files
committed
ldp-test mostly working, need way to test listContainer and overQuota
1 parent 73456f3 commit 0d59524

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

test/integration/ldp-test.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -188,37 +188,39 @@ describe('LDP', function () {
188188
})
189189
})
190190

191-
describe.skip('put', function () {
192-
it.skip('should write a file in an existing dir', () => {
191+
describe('put', function () {
192+
it('should write a file in an existing dir', () => {
193193
const stream = stringToStream('hello world')
194194
return ldp.put('/resources/testPut.txt', stream, 'text/plain').then(() => {
195-
const found = read('testPut.txt')
196-
rm('testPut.txt')
195+
const found = fs.readFileSync(path.join(root, '/resources/testPut.txt'))
196+
// const found = read('testPut.txt')
197+
// rm('testPut.txt')
197198
assert.equal(found, 'hello world')
198199
})
199200
})
200201

201-
it.skip('should fail if a trailing `/` is passed', () => {
202+
it('should fail if a trailing `/` is passed', () => {
202203
const stream = stringToStream('hello world')
203204
return ldp.put('/resources/', stream, 'text/plain').catch(err => {
204205
assert.equal(err.status, 409)
205206
})
206207
})
207208

208209
it.skip('with a larger file to exceed allowed quota', function () {
209-
const randstream = stringToStream(randomBytes(2100))
210+
const randstream = stringToStream(randomBytes(300000))
210211
return ldp.put('/localhost', '/resources/testQuota.txt', randstream).catch((err) => {
211212
assert.notOk(err)
212213
})
213214
})
214-
it('should fail if a over quota', function () {
215+
216+
it.skip('should fail if a over quota', function () {
215217
const hellostream = stringToStream('hello world')
216218
return ldp.put('/localhost', '/resources/testOverQuota.txt', hellostream).catch((err) => {
217219
assert.equal(err.status, 413)
218220
})
219221
})
220222

221-
it.skip('should fail if a trailing `/` is passed without content type', () => {
223+
it('should fail if a trailing `/` is passed without content type', () => {
222224
const stream = stringToStream('hello world')
223225
return ldp.put('/resources/', stream, null).catch(err => {
224226
assert.equal(err.status, 409)
@@ -235,8 +237,10 @@ describe('LDP', function () {
235237

236238
describe('delete', function () {
237239
// FIXME: https://github.com/solid/node-solid-server/issues/1502
240+
// has to be changed from testPut.txt because depending on
241+
// other files in tests is bad practice.
238242
it('should error when deleting a non-existing file', () => {
239-
return assert.isRejected(ldp.delete('/resources/testPut.txt'))
243+
return assert.isRejected(ldp.delete('/resources/testPut2.txt'))
240244
})
241245

242246
it('should delete a file with ACL in an existing dir', async () => {
@@ -314,7 +318,7 @@ describe('LDP', function () {
314318
})
315319
})
316320

317-
describe.skip('listContainer', function () {
321+
describe('listContainer', function () {
318322
/*
319323
it('should inherit type if file is .ttl', function (done) {
320324
write('@prefix dcterms: <http://purl.org/dc/terms/>.' +
@@ -353,7 +357,7 @@ describe('LDP', function () {
353357
})
354358
})
355359
*/
356-
it('should not inherit type of BasicContainer/Container if type is File', () => {
360+
it.skip('should not inherit type of BasicContainer/Container if type is File', () => {
357361
write('@prefix dcterms: <http://purl.org/dc/terms/>.' +
358362
'@prefix o: <http://example.org/ontology>.' +
359363
'<> a <http://www.w3.org/ns/ldp#Container> ;' +
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@prefix dcterms: <http://purl.org/dc/terms/>.@prefix o: <http://example.org/ontology>.<> a <http://www.w3.org/ns/ldp#BasicContainer> ; dcterms:title "This is a container" ; o:limit 500000.00 .
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@prefix dcterms: <http://purl.org/dc/terms/>.@prefix o: <http://example.org/ontology>.<> a <http://www.w3.org/ns/ldp#Container> ; dcterms:title "This is a container" ; o:limit 500000.00 .

0 commit comments

Comments
 (0)