Skip to content

Commit 2fbb0b1

Browse files
committed
fixed more ldp tests
1 parent 81577bf commit 2fbb0b1

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

lib/ldp.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,12 @@ class LDP {
456456
async isOwner (webId, hostname) {
457457
// const ldp = req.app.locals.ldp
458458
const rootUrl = this.resourceMapper.resolveUrl(hostname)
459+
console.log('isOwner root url: ' + rootUrl)
459460
let graph
460461
try {
461462
// TODO check for permission ?? Owner is a MUST
462463
graph = await this.getGraph(rootUrl + '/.meta')
464+
console.log('isOwner graph: ' + graph)
463465
const SOLID = $rdf.Namespace('http://www.w3.org/ns/solid/terms#')
464466
const owner = await graph.statementsMatching($rdf.sym(webId), SOLID('account'), $rdf.sym(rootUrl + '/'))
465467
return owner.length

test/integration/ldp-test.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const intoStream = require('into-stream')
2222

2323
describe('LDP', function () {
2424
console.log(__dirname)
25-
const root = path.join(__dirname, '../resources/ldp-test')
25+
const root = path.join(__dirname, '../resources/ldp-test/')
2626
console.log(root)
2727
const resourceMapper = new ResourceMapper({
2828
rootUrl: 'https://localhost:8443/',
@@ -32,13 +32,19 @@ describe('LDP', function () {
3232

3333
const ldp = new LDP({
3434
resourceMapper,
35-
serverUri: 'https://localhost',
35+
serverUri: 'https://localhost/',
3636
multiuser: true,
3737
webid: false
3838
})
3939

4040
this.beforeAll(() => {
41+
const metaData = `# Root Meta resource for the user account
42+
# Used to discover the account's WebID URI, given the account URI
43+
<https://tim.localhost:7777/profile/card#me>
44+
<http://www.w3.org/ns/solid/terms#account>
45+
</>.`
4146
fs.mkdirSync(root, { recursive: true })
47+
fs.writeFileSync(path.join(root, '.meta'), metaData)
4248
fs.mkdirSync(path.join(root, '/resources/'), { recursive: true })
4349
fs.mkdirSync(path.join(root, '/resources/sampleContainer/'), { recursive: true })
4450
})
@@ -106,7 +112,7 @@ describe('LDP', function () {
106112
})
107113
})
108114

109-
describe.skip('isOwner', () => {
115+
describe('isOwner', () => {
110116
it('should return acl:owner true', () => {
111117
const owner = 'https://tim.localhost:7777/profile/card#me'
112118
return ldp.isOwner(owner, '/resources/')
@@ -122,7 +128,8 @@ describe('LDP', function () {
122128
})
123129
})
124130
})
125-
describe.skip('getGraph', () => {
131+
132+
describe('getGraph', () => {
126133
it('should read and parse an existing file', () => {
127134
const uri = 'https://localhost:8443/resources/sampleContainer/example1.ttl'
128135
return ldp.getGraph(uri)

0 commit comments

Comments
 (0)