Skip to content

Commit

Permalink
Merge pull request #5061 from owncloud/debug-fails
Browse files Browse the repository at this point in the history
[tests-only] Refactor webdavHelper:getTrashBinElements function
  • Loading branch information
saw-jan authored May 4, 2021
2 parents 7a1164d + 3c6309d commit 5d2fdef
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/acceptance/helpers/webdavHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,14 @@ exports.getTrashBinElements = function(user, depth = 2) {
depth
)
.then(str => {
const trashData = convert.xml2js(str, { compact: true })['d:multistatus']['d:response']
let trashData = convert.xml2js(str, { compact: true })['d:multistatus']['d:response']
const trashItems = []
// 'trashData' gets object instead of array when there are no any files/folders in the trashbin
// so trashData.map() will cause error if trashData gets object
// following wraps the object in array
if (!Array.isArray(trashData)) {
trashData = [trashData]
}
trashData.map(trash => {
if (trash['d:propstat']['d:prop'] === undefined) {
reject(new Error('trashbin data not defined'))
Expand Down

0 comments on commit 5d2fdef

Please sign in to comment.