Skip to content

Commit

Permalink
fix(search.js): rename underMaintenance to showMaintenance
Browse files Browse the repository at this point in the history
BREAKING CHANGE: You need to use showMaintenance instead underMaintenance matcher in AppSection filters
  • Loading branch information
cballevre committed Dec 15, 2022
1 parent 83cb5c5 commit 295058a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
7 changes: 4 additions & 3 deletions react/AppSections/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ const doctypeMatcher = doctype => app => {
}
const pendingUpdateMatcher = () => app => !!app.availableVersion

const underMaintenanceMatcher = isUnderMaintenance => app => {
return (app.maintenance !== undefined) === isUnderMaintenance
const showMaintenanceMatcher = isShowMaintenance => app => {
if (isShowMaintenance) return true
return app.maintenance === undefined
}

const searchAttrToMatcher = {
Expand All @@ -37,7 +38,7 @@ const searchAttrToMatcher = {
tag: tagMatcher,
doctype: doctypeMatcher,
pendingUpdate: pendingUpdateMatcher,
underMaintenance: underMaintenanceMatcher
showMaintenance: showMaintenanceMatcher
}

/**
Expand Down
10 changes: 6 additions & 4 deletions react/AppSections/search.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,19 @@ describe('makeMatcherFromSearch', () => {
expect(mockApps.filter(matcher)).toMatchSnapshot()
})

it('should filter correctly when under maintenance is false', () => {
const matcher = makeMatcherFromSearch({ underMaintenance: false })
it('should filter correctly when show maintenance is false', () => {
const matcher = makeMatcherFromSearch({ showMaintenance: false })
expect(mockMaintenanceApps.filter(matcher)).toStrictEqual([
{ slug: 'collect' },
{ slug: 'drive' }
])
})

it('should filter correctly when under maintenance is true', () => {
const matcher = makeMatcherFromSearch({ underMaintenance: true })
it('should filter correctly when show maintenance is true', () => {
const matcher = makeMatcherFromSearch({ showMaintenance: true })
expect(mockMaintenanceApps.filter(matcher)).toStrictEqual([
{ slug: 'collect' },
{ slug: 'drive' },
{
maintenance: {
flag_disallow_manual_exec: true,
Expand Down

0 comments on commit 295058a

Please sign in to comment.