Skip to content

Commit 35ab538

Browse files
Make the PUT update test self-contained
1 parent 05acfb8 commit 35ab538

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

test/integration/ldp.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ describe('LDP', function () {
126126

127127
after(() => {
128128
rm('new-container/')
129+
rm('new-container2/')
129130
})
130131

131132
it('should write a file in an existing dir', function (done) {
@@ -156,18 +157,28 @@ describe('LDP', function () {
156157
})
157158

158159
it('should update existing container meta', done => {
160+
const containerMeta = '<> dcterms:title "Home loans".'
159161
const newMeta = '<> dcterms:title "Car loans".'
160-
const stream = stringToStream(newMeta)
161162

162-
ldp.put('localhost', '/resources/new-container/', stream, (err, status) => {
163+
let stream = stringToStream(containerMeta)
164+
165+
ldp.put('localhost', '/resources/new-container2/', stream, (err, status) => {
163166
if (err) { return done(err) }
164167

165-
assert.equal(status, 204)
168+
assert.equal(status, 201)
166169

167-
let written = read('new-container/.meta')
168-
assert.equal(written, newMeta)
170+
stream = stringToStream(newMeta)
169171

170-
done()
172+
ldp.put('localhost', '/resources/new-container2/', stream, (err, status) => {
173+
if (err) { return done(err) }
174+
175+
assert.equal(status, 204)
176+
177+
let written = read('new-container2/.meta')
178+
assert.equal(written, newMeta)
179+
180+
done()
181+
})
171182
})
172183
})
173184
})

0 commit comments

Comments
 (0)