Skip to content

Commit 81577bf

Browse files
committed
fixing ldp tests more
1 parent 0c1dce0 commit 81577bf

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

lib/ldp.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ class LDP {
100100
if (url[url.length - 1] !== '/') {
101101
url += '/'
102102
}
103+
console.log('readContainerMeta url: ' + url)
104+
console.log('readContainerMeta url with suffix: ' + (url + this.suffixMeta))
103105
return this.readResource(url + this.suffixMeta)
104106
}
105107

test/integration/ldp-test.js

Lines changed: 10 additions & 7 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/',
@@ -39,7 +39,8 @@ describe('LDP', function () {
3939

4040
this.beforeAll(() => {
4141
fs.mkdirSync(root, { recursive: true })
42-
fs.mkdirSync(`${root}/resources/`, { recursive: true })
42+
fs.mkdirSync(path.join(root, '/resources/'), { recursive: true })
43+
fs.mkdirSync(path.join(root, '/resources/sampleContainer/'), { recursive: true })
4344
})
4445

4546
this.afterAll(() => {
@@ -70,7 +71,7 @@ describe('LDP', function () {
7071

7172
it('return file if file exists', () => {
7273
// file can be empty as well
73-
fs.writeFileSync(`${root}/resources/fileExists.txt`, 'hello world')
74+
fs.writeFileSync(path.join(root, '/resources/fileExists.txt'), 'hello world')
7475
return ldp.readResource('/resources/fileExists.txt').then(file => {
7576
assert.equal(file, 'hello world')
7677
})
@@ -86,18 +87,20 @@ describe('LDP', function () {
8687

8788
it('should return content if metaFile exists', () => {
8889
// file can be empty as well
89-
write('This function just reads this, does not parse it', 'sampleContainer/.meta')
90+
// write('This function just reads this, does not parse it', 'sampleContainer/.meta')
91+
fs.writeFileSync(path.join(root, 'resources/sampleContainer/.meta'), 'This function just reads this, does not parse it')
9092
return ldp.readContainerMeta('/resources/sampleContainer/').then(metaFile => {
91-
rm('sampleContainer/.meta')
93+
// rm('sampleContainer/.meta')
9294
assert.equal(metaFile, 'This function just reads this, does not parse it')
9395
})
9496
})
9597

9698
it('should work also if trailing `/` is not passed', () => {
9799
// file can be empty as well
98-
write('This function just reads this, does not parse it', 'sampleContainer/.meta')
100+
// write('This function just reads this, does not parse it', 'sampleContainer/.meta')
101+
fs.writeFileSync(path.join(root, 'resources/sampleContainer/.meta'), 'This function just reads this, does not parse it')
99102
return ldp.readContainerMeta('/resources/sampleContainer').then(metaFile => {
100-
rm('sampleContainer/.meta')
103+
// rm('sampleContainer/.meta')
101104
assert.equal(metaFile, 'This function just reads this, does not parse it')
102105
})
103106
})

0 commit comments

Comments
 (0)