Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

test: make refs tests iteration order independent #2982

Merged
merged 2 commits into from
Jun 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions packages/interface-ipfs-core/src/refs.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ module.exports = (common, options) => {

const refs = await all(ipfs.refs(p, params))

// Sort the refs not to lock-in the iteration order
// Check there was no error and the refs match what was expected
expect(refs.map(r => r.ref)).to.eql(expected)
expect(refs.map(r => r.ref).sort()).to.eql(expected.sort())
})
}

Expand Down Expand Up @@ -198,19 +199,19 @@ function getRefsTests () {
},

'should get refs with recursive and unique option': {
params: { format: '<linkname>', recursive: true, unique: true },
params: { format: '<dst>', recursive: true, unique: true },
expected: [
'animals',
'land',
'african.txt',
'americas.txt',
'australian.txt',
'sea',
'atlantic.txt',
'indian.txt',
'fruits',
'tropical.txt',
'mushroom.txt'
'QmRfqT4uTUgFXhWbfBZm6eZxi2FQ8pqYK5tcWRyTZ7RcgY',
'QmUXzZKa3xhTauLektUiK4GiogHskuz1c57CnnoP4TgYJD',
'QmVX54jfjB8eRxLVxyQSod6b1FyDh7mR4mQie9j97i2Qk3',
'QmWEuXAjUGyndgr4MKqMBgzMW36XgPgvitt2jsXgtuc7JE',
'QmYEJ7qQNZUvBnv4SZ3rEbksagaan3sGvnUq948vSG8Z34',
'QmYLvZrFn8KE2bcJ9UFhthScBVbbcXEgkJnnCBeKWYkpuQ',
'Qma5z9bmwPcrWLJxX6Vj6BrcybaFg84c2riNbUKrSVf8h1',
'QmbrFTo4s6H23W6wmoZKQC2vSogGeQ4dYiceSqJddzrKVa',
'QmdHVR8M4zAdGctnTYq4fyPZjTwwzdcBpGWAfMAhAVfT9n',
'Qmf6MrqT2oAve9diagLTMCYFPEcSx7fnUdW3xAjhXm32vo',
'QmfP6D9bRV4FEYDL4EHZtZG58kDwDfnzmyjuyK5d1pvzbM'
]
},

Expand Down