Skip to content

Commit e589850

Browse files
committed
ldp tests all passing
1 parent cdc052d commit e589850

File tree

4 files changed

+21
-28
lines changed

4 files changed

+21
-28
lines changed

lib/ldp.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ class LDP {
103103

104104
async listContainer (container, reqUri, containerData, hostname) {
105105
const resourceGraph = $rdf.graph()
106-
107106
try {
108107
$rdf.parse(containerData, resourceGraph, reqUri, 'text/turtle')
109108
} catch (err) {

test/integration/ldp-test.js

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const rm = require('./../utils').rm
1414
// this write function destroys
1515
// the flexibility of this test unit
1616
// highly recommend removing it
17-
const write = require('./../utils').write
17+
// const write = require('./../utils').write
1818
// var cp = require('./utils').cp
1919
const read = require('./../utils').read
2020
const fs = require('fs')
@@ -351,7 +351,7 @@ describe('LDP', function () {
351351
})
352352
})
353353

354-
describe.skip('listContainer', function () {
354+
describe('listContainer', function () {
355355
/*
356356
it('should inherit type if file is .ttl', function (done) {
357357
write('@prefix dcterms: <http://purl.org/dc/terms/>.' +
@@ -391,35 +391,32 @@ describe('LDP', function () {
391391
})
392392
*/
393393
it('should not inherit type of BasicContainer/Container if type is File', () => {
394-
write('@prefix dcterms: <http://purl.org/dc/terms/>.' +
395-
'@prefix o: <http://example.org/ontology>.' +
396-
'<> a <http://www.w3.org/ns/ldp#Container> ;' +
397-
' dcterms:title "This is a container" ;' +
398-
' o:limit 500000.00 .', 'sampleContainer/containerFile.ttl')
399-
400-
write('@prefix dcterms: <http://purl.org/dc/terms/>.' +
401-
'@prefix o: <http://example.org/ontology>.' +
402-
'<> a <http://www.w3.org/ns/ldp#BasicContainer> ;' +
403-
' dcterms:title "This is a container" ;' +
404-
' o:limit 500000.00 .', 'sampleContainer/basicContainerFile.ttl')
405-
406-
return ldp.listContainer(path.join(__dirname, '../resources/sampleContainer/'), 'https://server.tld/resources/sampleContainer/', '', 'server.tld')
394+
const containerFileData = `'@prefix dcterms: <http://purl.org/dc/terms/>.' +
395+
'@prefix o: <http://example.org/ontology>.' +
396+
'<> a <http://www.w3.org/ns/ldp#Container> ;' +
397+
' dcterms:title "This is a container" ;' +
398+
' o:limit 500000.00 .'`
399+
fs.writeFileSync(path.join(root, '/resources/sampleContainer/containerFile.ttl'), containerFileData)
400+
const basicContainerFileData = `'@prefix dcterms: <http://purl.org/dc/terms/>.' +
401+
'@prefix o: <http://example.org/ontology>.' +
402+
'<> a <http://www.w3.org/ns/ldp#BasicContainer> ;' +
403+
' dcterms:title "This is a container" ;' +
404+
' o:limit 500000.00 .'`
405+
fs.writeFileSync(path.join(root, '/resources/sampleContainer/basicContainerFile.ttl'), basicContainerFileData)
406+
407+
return ldp.listContainer(path.join(root, '/resources/sampleContainer/'), 'https://server.tld/resources/sampleContainer/', '', 'server.tld')
407408
.then(data => {
408409
const graph = $rdf.graph()
409410
$rdf.parse(
410411
data,
411412
graph,
412413
'https://localhost:8443/resources/sampleContainer',
413414
'text/turtle')
414-
415-
const basicContainerStatements = graph
416-
.each(
417-
$rdf.sym('https://localhost:8443/resources/sampleContainer/basicContainerFile.ttl'),
418-
ns.rdf('type'),
419-
undefined
420-
)
421-
.map(d => { return d.uri })
422-
415+
const basicContainerStatements = graph.each(
416+
$rdf.sym('https://localhost:8443/resources/sampleContainer/basicContainerFile.ttl'),
417+
ns.rdf('type'),
418+
null
419+
).map(d => { return d.uri })
423420
const expectedStatements = [
424421
'http://www.w3.org/ns/iana/media-types/text/turtle#Resource',
425422
'http://www.w3.org/ns/ldp#Resource'
@@ -433,7 +430,6 @@ describe('LDP', function () {
433430
undefined
434431
)
435432
.map(d => { return d.uri })
436-
437433
assert.deepEqual(containerStatements.sort(), expectedStatements)
438434

439435
rm('sampleContainer/containerFile.ttl')

test/resources/sampleContainer/basicContainerFile.ttl

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/resources/sampleContainer/containerFile.ttl

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)