Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow multiple package names for trash dependencies #37

Merged
merged 1 commit into from
Jun 19, 2019
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ function getTrashDepends (version, dependencyMap) {
if (semver.lt(version, '1.4.1')) {
return [dependencyMap.gvfs]
} else if (semver.lt(version, '1.7.2')) {
return [dependencyMap.kdeCliTools, dependencyMap.kdeRuntime, dependencyMap.trashCli, dependencyMap.gvfs]
return _.flatten([dependencyMap.kdeCliTools, dependencyMap.kdeRuntime, dependencyMap.trashCli, dependencyMap.gvfs])
} else {
return [dependencyMap.kdeCliTools, dependencyMap.kdeRuntime, dependencyMap.trashCli, dependencyMap.glib2, dependencyMap.gvfs]
return _.flatten([dependencyMap.kdeCliTools, dependencyMap.kdeRuntime, dependencyMap.trashCli, dependencyMap.glib2, dependencyMap.gvfs])
}
}

Expand Down
14 changes: 10 additions & 4 deletions test/dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const dependencyMap = {
gconf: 'libgconf2-4',
uuid: 'libuuid1',
gvfs: 'gvfs-bin',
kdeCliTools: 'kde-cli-tools',
kdeCliTools: ['kde-cli-tools', 'kde-cli-tools5'],
kdeRuntime: 'kde-runtime',
trashCli: 'trash-cli',
glib2: 'libglib2.0-bin'
Expand Down Expand Up @@ -49,21 +49,27 @@ test('getGTKDepends: returns GTK3 as of 2.0', t => {
test('getTrashDepends: only depends on gvfs-bin before 1.4.1', t => {
const trashDepends = dependencies.getTrashDepends('v1.3.0', dependencyMap)
t.true(trashDepends.includes(dependencyMap.gvfs))
t.false(trashDepends.includes(dependencyMap.kdeCliTools))
for (const packageName of dependencyMap.kdeCliTools) {
t.false(trashDepends.includes(packageName))
}
t.false(trashDepends.includes(dependencyMap.glib2))
})

test('getTrashDepends: depends on KDE tools between 1.4.1 and 1.7.1', t => {
const trashDepends = dependencies.getTrashDepends('v1.6.0', dependencyMap)
t.true(trashDepends.includes(dependencyMap.gvfs))
t.true(trashDepends.includes(dependencyMap.kdeCliTools))
for (const packageName of dependencyMap.kdeCliTools) {
t.true(trashDepends.includes(packageName))
}
t.false(trashDepends.includes(dependencyMap.glib2))
})

test('getTrashDepends: depends on glib starting with 1.7.2', t => {
const trashDepends = dependencies.getTrashDepends('v1.8.2', dependencyMap)
t.true(trashDepends.includes(dependencyMap.gvfs))
t.true(trashDepends.includes(dependencyMap.kdeCliTools))
for (const packageName of dependencyMap.kdeCliTools) {
t.true(trashDepends.includes(packageName))
}
t.true(trashDepends.includes(dependencyMap.glib2))
})

Expand Down