more test fixes
This commit is contained in:
parent
7505c94986
commit
b09efcb5f3
2 changed files with 16 additions and 19 deletions
|
|
@ -1,7 +1,8 @@
|
||||||
import { showDesktopNotification } from '../desktop_notification_utils/desktop_notification_utils.js'
|
import { showDesktopNotification } from '../desktop_notification_utils/desktop_notification_utils.js'
|
||||||
import { muteFilterHits } from '../status_parser/status_parser.js'
|
import { muteFilterHits } from '../status_parser/status_parser.js'
|
||||||
|
|
||||||
import { useAnnouncementsStore } from 'src/stores/announcements'
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
|
import { useAnnouncementsStore } from 'src/stores/announcements.js'
|
||||||
import { useI18nStore } from 'src/stores/i18n.js'
|
import { useI18nStore } from 'src/stores/i18n.js'
|
||||||
|
|
||||||
import FaviconService from 'src/services/favicon_service/favicon_service.js'
|
import FaviconService from 'src/services/favicon_service/favicon_service.js'
|
||||||
|
|
@ -100,14 +101,14 @@ export const filteredNotificationsFromStore = (
|
||||||
.map((_) => _)
|
.map((_) => _)
|
||||||
.sort(sortById)
|
.sort(sortById)
|
||||||
// TODO implement sorting elsewhere and make it optional
|
// TODO implement sorting elsewhere and make it optional
|
||||||
|
console.log(types, visibleTypes(notificationVisibility))
|
||||||
return sortedNotifications.filter((notification) =>
|
return sortedNotifications.filter((notification) =>
|
||||||
(types || visibleTypes(notificationVisibility)).includes(notification.type),
|
(types || visibleTypes(notificationVisibility)).includes(notification.type),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const unseenNotificationsFromStore = (store, notificationVisibility) => {
|
export const unseenNotificationsFromStore = (store, notificationVisibility) => {
|
||||||
const rootGetters = store.rootGetters || store.getters
|
const ignoreInactionableSeen = useSyncConfigStore().mergedConfig.ignoreInactionableSeen
|
||||||
const ignoreInactionableSeen = rootGetters.mergedConfig.ignoreInactionableSeen
|
|
||||||
|
|
||||||
return filteredNotificationsFromStore(store, notificationVisibility).filter(
|
return filteredNotificationsFromStore(store, notificationVisibility).filter(
|
||||||
({ seen, type }) => {
|
({ seen, type }) => {
|
||||||
|
|
@ -188,10 +189,7 @@ export const prepareNotificationObject = (notification, i18n) => {
|
||||||
return notifObj
|
return notifObj
|
||||||
}
|
}
|
||||||
|
|
||||||
export const countExtraNotifications = (store) => {
|
export const countExtraNotifications = (mergedConfig) => {
|
||||||
const rootGetters = store.rootGetters || store.getters
|
|
||||||
const mergedConfig = rootGetters.mergedConfig
|
|
||||||
|
|
||||||
if (!mergedConfig.showExtraNotifications) {
|
if (!mergedConfig.showExtraNotifications) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,11 @@ describe('NotificationUtils', () => {
|
||||||
type: 'like',
|
type: 'like',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
expect(NotificationUtils.filteredNotificationsFromStore(store)).to.eql(
|
expect(NotificationUtils.filteredNotificationsFromStore(store, {
|
||||||
|
mentions: false,
|
||||||
|
likes: true,
|
||||||
|
repeats: true,
|
||||||
|
})).to.eql(
|
||||||
expected,
|
expected,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
@ -77,16 +81,7 @@ describe('NotificationUtils', () => {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
getters: {
|
|
||||||
mergedConfig: {
|
|
||||||
notificationVisibility: {
|
|
||||||
likes: true,
|
|
||||||
repeats: true,
|
|
||||||
mentions: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
const expected = [
|
const expected = [
|
||||||
{
|
{
|
||||||
|
|
@ -95,7 +90,11 @@ describe('NotificationUtils', () => {
|
||||||
seen: false,
|
seen: false,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
expect(NotificationUtils.unseenNotificationsFromStore(store)).to.eql(
|
expect(NotificationUtils.unseenNotificationsFromStore(store, {
|
||||||
|
likes: true,
|
||||||
|
repeats: true,
|
||||||
|
mentions: false,
|
||||||
|
})).to.eql(
|
||||||
expected,
|
expected,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue