Skip to content

Commit

Permalink
Apps search fix
Browse files Browse the repository at this point in the history
* Two apps with same name, but different paths now will be displayed
* Update cerebro-tools
  • Loading branch information
KELiON committed Jan 30, 2017
1 parent b288aa4 commit 9be29e8
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/main/plugins/core/apps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const appsPlugin = ({ term, actions, display }) => {
).map(file => {
const { path, name } = file
return {
id: path,
title: name,
term: name,
icon: path,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
"webpack-visualizer-plugin": "0.1.5"
},
"dependencies": {
"cerebro-tools": "0.1.7",
"cerebro-tools": "0.1.8",
"co": "4.6.0",
"du": "0.1.0",
"escape-string-regexp": "1.0.5",
Expand Down
35 changes: 35 additions & 0 deletions test/plugins/apps/index.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import appsInjector from 'inject!../../../app/main/plugins/core/apps'
import assert from 'assert'
import uniq from 'lodash/uniq'

let appsList = [
{
name: 'App Store',
filename: 'App Store.app',
path: '/Applications/App Store.app'
},
{
name: 'App Store',
filename: 'App Store.prefPane',
path: '/System/Library/PreferencePanes/AppStore.prefPane'
}
]
const getAppsList = () => Promise.resolve(appsList)

const apps = appsInjector({
'./lib/getAppsList': getAppsList,
'react': () => {},
'./Preview': () => {},
})

describe('OSx apps plugin', () => {
it('shows two apps with the same name but different paths', (done) => {
const term = 'App'
const display = (results) => {
const ids = results.map(file => file.id || file.title)
assert(uniq(ids).length === 2)
done()
}
apps.fn({ term, display })
})
})

0 comments on commit 9be29e8

Please sign in to comment.