From c611788e7773eb5ed97191e08ca311fb9215d82f Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 2 Sep 2026 17:26:08 +0300 Subject: [PATCH] cleanup --- src/api/user.js | 7 +- src/components/draft/draft.js | 10 ++- src/components/drafts/drafts.js | 6 +- src/components/navigation/navigation_entry.js | 6 +- .../post_status_form/post_status_form.js | 2 +- .../settings_modal/helpers/setting.js | 5 +- .../settings_modal/tabs/composing_tab.js | 2 +- src/components/side_drawer/side_drawer.js | 2 +- src/lib/persisted_state.js | 15 +--- src/main.js | 4 - src/stores/drafts.js | 9 ++- src/stores/profile_config.js | 4 +- src/stores/users.js | 4 +- test/fixtures/setup_test.js | 18 +---- test/unit/specs/components/draft.spec.js | 2 +- .../specs/components/post_status_form.spec.js | 2 +- .../specs/components/rich_content.spec.js | 2 +- test/unit/specs/stores/sync_config.spec.js | 80 ++++--------------- vite.config.js | 1 + 19 files changed, 59 insertions(+), 122 deletions(-) diff --git a/src/api/user.js b/src/api/user.js index 430b2c895..d3a2a4a70 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -17,8 +17,11 @@ const CHANGE_EMAIL_URL = '/api/pleroma/change_email' const CHANGE_PASSWORD_URL = '/api/pleroma/change_password' const MOVE_ACCOUNT_URL = '/api/pleroma/move_account' const ALIASES_URL = '/api/pleroma/aliases' -const NOTIFICATION_SETTINGS_URL = ({ blockFromStrangers, hideNotificationContents }) => - `/api/pleroma/notification_settings${paramsString({ blockFromStrangers, hideNotificationContents })}` +const NOTIFICATION_SETTINGS_URL = ({ + blockFromStrangers, + hideNotificationContents, +}) => + `/api/pleroma/notification_settings${paramsString({ blockFromStrangers, hideNotificationContents })}` export const NOTIFICATION_READ_URL = '/api/v1/pleroma/notifications/read' const MFA_SETTINGS_URL = '/api/pleroma/accounts/mfa' diff --git a/src/components/draft/draft.js b/src/components/draft/draft.js index 582381ec6..5f17738d0 100644 --- a/src/components/draft/draft.js +++ b/src/components/draft/draft.js @@ -5,9 +5,9 @@ import Gallery from 'src/components/gallery/gallery.vue' import PostStatusForm from 'src/components/post_status_form/post_status_form.vue' import StatusContent from 'src/components/status_content/status_content.vue' +import { useDraftsStore } from 'src/stores/drafts.js' import { useMergedConfigStore } from 'src/stores/merged_config.js' import { useStatusesStore } from 'src/stores/statuses.js' -import { useDraftsStore } from 'src/stores/drafts.js' import { library } from '@fortawesome/fontawesome-svg-core' import { faPollH } from '@fortawesome/free-solid-svg-icons' @@ -92,9 +92,11 @@ const Draft = { this.showingConfirmDialog = true }, doAbandon() { - useDraftsStore().abandonDraft(this.draft.id).then(() => { - this.hideConfirmDialog() - }) + useDraftsStore() + .abandonDraft(this.draft.id) + .then(() => { + this.hideConfirmDialog() + }) }, hideConfirmDialog() { this.showingConfirmDialog = false diff --git a/src/components/drafts/drafts.js b/src/components/drafts/drafts.js index c2cac4f13..3a37c0862 100644 --- a/src/components/drafts/drafts.js +++ b/src/components/drafts/drafts.js @@ -1,9 +1,10 @@ import { defineAsyncComponent } from 'vue' -import { useDraftsStore } from 'src/stores/drafts.js' import Draft from 'src/components/draft/draft.vue' import List from 'src/components/list/list.vue' +import { useDraftsStore } from 'src/stores/drafts.js' + const Drafts = { components: { Draft, @@ -27,7 +28,8 @@ const Drafts = { this.showingConfirmDialog = true }, doAbandonAll() { - useDraftsStore().abandonAllDrafts() + useDraftsStore() + .abandonAllDrafts() .then(() => this.hideConfirmDialog()) }, hideConfirmDialog() { diff --git a/src/components/navigation/navigation_entry.js b/src/components/navigation/navigation_entry.js index daa6284ff..49392b37a 100644 --- a/src/components/navigation/navigation_entry.js +++ b/src/components/navigation/navigation_entry.js @@ -4,11 +4,11 @@ import { routeTo } from 'src/components/navigation/navigation.js' import OptionalRouterLink from 'src/components/optional_router_link/optional_router_link.vue' import { useAnnouncementsStore } from 'src/stores/announcements.js' +import { useChatsStore } from 'src/stores/chats.js' +import { useDraftsStore } from 'src/stores/drafts.js' +import { useFollowRequestsStore } from 'src/stores/follow_requests.js' import { useSyncConfigStore } from 'src/stores/sync_config.js' import { useUsersStore } from 'src/stores/users.js' -import { useDraftsStore } from 'src/stores/drafts.js' -import { useChatsStore } from 'src/stores/chats.js' -import { useFollowRequestsStore } from 'src/stores/follow_requests.js' import { library } from '@fortawesome/fontawesome-svg-core' import { faThumbtack } from '@fortawesome/free-solid-svg-icons' diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index a261f9937..b708d3f68 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -24,6 +24,7 @@ import { findOffset } from '../../services/offset_finder/offset_finder.service.j import genRandomSeed from '../../services/random_seed/random_seed.service.js' import statusPoster from '../../services/status_poster/status_poster.service.js' +import { useDraftsStore } from 'src/stores/drafts.js' import { useEmojiStore } from 'src/stores/emoji.js' import { useInstanceStore } from 'src/stores/instance.js' import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' @@ -32,7 +33,6 @@ import { useMediaViewerStore } from 'src/stores/media_viewer.js' import { useMergedConfigStore } from 'src/stores/merged_config.js' import { useSyncConfigStore } from 'src/stores/sync_config.js' import { useUsersStore } from 'src/stores/users.js' -import { useDraftsStore } from 'src/stores/drafts.js' import { pollFormToMasto } from 'src/services/poll/poll.service.js' diff --git a/src/components/settings_modal/helpers/setting.js b/src/components/settings_modal/helpers/setting.js index a3fc5931e..31afc9068 100644 --- a/src/components/settings_modal/helpers/setting.js +++ b/src/components/settings_modal/helpers/setting.js @@ -8,8 +8,8 @@ import { useAdminSettingsStore } from 'src/stores/admin_settings.js' import { useInterfaceStore } from 'src/stores/interface.js' import { useLocalConfigStore } from 'src/stores/local_config.js' import { useMergedConfigStore } from 'src/stores/merged_config.js' -import { useSyncConfigStore } from 'src/stores/sync_config.js' import { useProfileConfigStore } from 'src/stores/profile_config.js' +import { useSyncConfigStore } from 'src/stores/sync_config.js' export default { components: { @@ -413,7 +413,8 @@ export default { hardReset() { switch (this.realSource) { case 'admin': - return useAdminSettingsStore().resetAdminSetting({ path: this.path }) + return useAdminSettingsStore() + .resetAdminSetting({ path: this.path }) .then(() => { this.draft = this.state }) diff --git a/src/components/settings_modal/tabs/composing_tab.js b/src/components/settings_modal/tabs/composing_tab.js index 74f01a2e1..7701d1673 100644 --- a/src/components/settings_modal/tabs/composing_tab.js +++ b/src/components/settings_modal/tabs/composing_tab.js @@ -16,8 +16,8 @@ import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.j import { useInterfaceStore } from 'src/stores/interface.js' import { useMergedConfigStore } from 'src/stores/merged_config.js' import { useOAuthStore } from 'src/stores/oauth.js' -import { useSyncConfigStore } from 'src/stores/sync_config.js' import { useProfileConfigStore } from 'src/stores/profile_config.js' +import { useSyncConfigStore } from 'src/stores/sync_config.js' import { useUsersStore } from 'src/stores/users.js' import { updateProfile } from 'src/api/user.js' diff --git a/src/components/side_drawer/side_drawer.js b/src/components/side_drawer/side_drawer.js index 5949649a0..fb0152ece 100644 --- a/src/components/side_drawer/side_drawer.js +++ b/src/components/side_drawer/side_drawer.js @@ -7,6 +7,7 @@ import { unseenNotifications } from '../../services/notification_utils/notificat import { useAnnouncementsStore } from 'src/stores/announcements' import { useChatsStore } from 'src/stores/chats.js' +import { useDraftsStore } from 'src/stores/drafts.js' import { useFollowRequestsStore } from 'src/stores/follow_requests.js' import { useInstanceStore } from 'src/stores/instance.js' import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' @@ -14,7 +15,6 @@ import { useInterfaceStore } from 'src/stores/interface' import { useMergedConfigStore } from 'src/stores/merged_config.js' import { useShoutStore } from 'src/stores/shout' import { useUsersStore } from 'src/stores/users.js' -import { useDraftsStore } from 'src/stores/drafts.js' import { library } from '@fortawesome/fontawesome-svg-core' import { diff --git a/src/lib/persisted_state.js b/src/lib/persisted_state.js index d4e0b1de2..5a698ac8e 100644 --- a/src/lib/persisted_state.js +++ b/src/lib/persisted_state.js @@ -1,11 +1,7 @@ -import { cloneDeep, each, get, merge, set } from 'lodash' +import { cloneDeep, get, set } from 'lodash' import { storage } from './storage.js' -import { useInterfaceStore } from 'src/stores/interface' - -let loaded = false - const defaultReducer = (state, paths) => paths.length === 0 ? state @@ -14,15 +10,6 @@ const defaultReducer = (state, paths) => return substate }, {}) -const saveImmedeatelyActions = [ - 'markNotificationsAsSeen', - 'setHighlight', - 'setOption', - 'setClientData', - 'setToken', - 'clearToken', -] - const defaultStorage = (() => { return storage })() diff --git a/src/main.js b/src/main.js index f3615d955..953346427 100644 --- a/src/main.js +++ b/src/main.js @@ -33,10 +33,6 @@ const i18n = createI18n({ messages.setLanguage(i18n.global, currentLocale) -const persistedStateOptions = { - paths: ['oauth', 'config'], -} - ;(async () => { const isFox = Math.floor(Math.random() * 2) > 0 ? '_fox' : '' diff --git a/src/stores/drafts.js b/src/stores/drafts.js index bca8ccac0..8325fba5b 100644 --- a/src/stores/drafts.js +++ b/src/stores/drafts.js @@ -1,4 +1,5 @@ import { defineStore } from 'pinia' + import { storage } from 'src/lib/storage.js' const storageKey = 'pleroma-fe-drafts' @@ -18,13 +19,13 @@ const storageKey = 'pleroma-fe-drafts' const getStorageData = async () => await storage.getItem(storageKey) const saveDraftToStorage = async (draft) => { - const currentData = await getStorageData() ?? {} + const currentData = (await getStorageData()) ?? {} currentData[draft.id] = JSON.parse(JSON.stringify(draft)) await storage.setItem(storageKey, currentData) } const deleteDraftFromStorage = async (ids) => { - const currentData = await getStorageData() ?? {} + const currentData = (await getStorageData()) ?? {} ids.forEach((id) => { delete currentData[id] }) @@ -33,7 +34,7 @@ const deleteDraftFromStorage = async (ids) => { export const useDraftsStore = defineStore('drafts', { state: () => ({ - drafts: new Map() + drafts: new Map(), }), getters: { draftsByTypeAndRefId(state) { @@ -71,5 +72,5 @@ export const useDraftsStore = defineStore('drafts', { ids.forEach((id) => this.abandonDraft(id)) await deleteDraftFromStorage(ids) }, - } + }, }) diff --git a/src/stores/profile_config.js b/src/stores/profile_config.js index 7533575d0..5d43ea446 100644 --- a/src/stores/profile_config.js +++ b/src/stores/profile_config.js @@ -97,7 +97,9 @@ export const settingsMap = { } export const defaultState = () => ({ - config: Object.fromEntries(Object.keys(settingsMap).map((key) => [key, null])) + config: Object.fromEntries( + Object.keys(settingsMap).map((key) => [key, null]), + ), }) export const useProfileConfigStore = defineStore('profileConfig', { diff --git a/src/stores/users.js b/src/stores/users.js index e713bb4c6..7093e9e03 100644 --- a/src/stores/users.js +++ b/src/stores/users.js @@ -5,6 +5,7 @@ import { defineStore } from 'pinia' import { useAnnouncementsStore } from 'src/stores/announcements.js' import { useBookmarkFoldersStore } from 'src/stores/bookmark_folders.js' import { useChatsStore } from 'src/stores/chats.js' +import { useDraftsStore } from 'src/stores/drafts.js' import { useEmojiStore } from 'src/stores/emoji.js' import { useFollowRequestsStore } from 'src/stores/follow_requests.js' import { useInstanceStore } from 'src/stores/instance.js' @@ -14,14 +15,13 @@ import { useListsStore } from 'src/stores/lists.js' import { useMergedConfigStore } from 'src/stores/merged_config.js' import { useNotificationsStore } from 'src/stores/notifications.js' import { useOAuthStore } from 'src/stores/oauth.js' +import { useProfileConfigStore } from 'src/stores/profile_config.js' import { useShoutStore } from 'src/stores/shout.js' import { useStatusesStore } from 'src/stores/statuses.js' import { useStreamingStore } from 'src/stores/streaming.js' import { useSyncConfigStore } from 'src/stores/sync_config.js' -import { useProfileConfigStore } from 'src/stores/profile_config.js' import { useTimelinesStore } from 'src/stores/timelines.js' import { useUserHighlightStore } from 'src/stores/user_highlight.js' -import { useDraftsStore } from 'src/stores/drafts.js' import { revokeToken } from 'src/api/oauth.js' import { diff --git a/test/fixtures/setup_test.js b/test/fixtures/setup_test.js index 3da0231a4..24acbdc4c 100644 --- a/test/fixtures/setup_test.js +++ b/test/fixtures/setup_test.js @@ -5,26 +5,15 @@ import VueVirtualScroller from 'vue-virtual-scroller' import RichContent from 'src/components/rich_content/rich_content.jsx' import Status from 'src/components/status/status.vue' import StillImage from 'src/components/still-image/still-image.vue' -import makeMockStore from './mock_store' import routes from 'src/boot/routes' export const $t = (msg) => msg const $i18n = { t: (msg) => msg } -const applyAfterStore = (store, afterStore) => { - afterStore(store) - return store -} - -const getDefaultOpts = ({ - afterStore = () => { - /* no-op */ - }, -} = {}) => ({ +const getDefaultOpts = () => ({ global: { plugins: [ - applyAfterStore(makeMockStore(), afterStore), VueVirtualScroller, createRouter({ history: createMemoryHistory(), @@ -87,9 +76,8 @@ const customBehaviors = () => { config.plugins.VueWrapper.install(customBehaviors) -export const mountOpts = (allOpts = {}) => { - const { afterStore, ...opts } = allOpts - const defaultOpts = getDefaultOpts({ afterStore }) +export const mountOpts = (opts = {}) => { + const defaultOpts = getDefaultOpts() const mergedOpts = { ...opts, global: { diff --git a/test/unit/specs/components/draft.spec.js b/test/unit/specs/components/draft.spec.js index 40d63419b..9e26e36b3 100644 --- a/test/unit/specs/components/draft.spec.js +++ b/test/unit/specs/components/draft.spec.js @@ -1,10 +1,10 @@ import { createTestingPinia } from '@pinia/testing' import { flushPromises, mount } from '@vue/test-utils' import { setActivePinia } from 'pinia' +import { $t, mountOpts, waitForEvent } from 'test/fixtures/setup_test.js' import { nextTick } from 'vue' import PostStatusForm from 'src/components/post_status_form/post_status_form.vue' -import { $t, mountOpts, waitForEvent } from '../../../fixtures/setup_test' import { useMergedConfigStore } from 'src/stores/merged_config.js' import { useUsersStore } from 'src/stores/users.js' diff --git a/test/unit/specs/components/post_status_form.spec.js b/test/unit/specs/components/post_status_form.spec.js index 981a6d020..1fddf4a95 100644 --- a/test/unit/specs/components/post_status_form.spec.js +++ b/test/unit/specs/components/post_status_form.spec.js @@ -1,10 +1,10 @@ import { createTestingPinia } from '@pinia/testing' import { mount } from '@vue/test-utils' import { setActivePinia } from 'pinia' +import { mountOpts } from 'test/fixtures/setup_test.js' import { vi } from 'vitest' import PostStatusForm from 'src/components/post_status_form/post_status_form.vue' -import { mountOpts } from '../../../fixtures/setup_test' import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { useMergedConfigStore } from 'src/stores/merged_config.js' diff --git a/test/unit/specs/components/rich_content.spec.js b/test/unit/specs/components/rich_content.spec.js index 19bfdc035..c20e4fe43 100644 --- a/test/unit/specs/components/rich_content.spec.js +++ b/test/unit/specs/components/rich_content.spec.js @@ -1,9 +1,9 @@ import { createTestingPinia } from '@pinia/testing' import { mount, shallowMount } from '@vue/test-utils' import { setActivePinia } from 'pinia' +import { mountOpts } from 'test/fixtures/setup_test.js' import RichContent from 'src/components/rich_content/rich_content.jsx' -import { mountOpts } from '../../../fixtures/setup_test' const attentions = [] diff --git a/test/unit/specs/stores/sync_config.spec.js b/test/unit/specs/stores/sync_config.spec.js index 3618068f7..cd1cc8904 100644 --- a/test/unit/specs/stores/sync_config.spec.js +++ b/test/unit/specs/stores/sync_config.spec.js @@ -37,10 +37,7 @@ describe('The SyncConfig store', () => { it('should initialize storage if none present', async () => { const store = useSyncConfigStore() - // PushSyncConfig is very simple but uses vuex to push data - store.pushSyncConfig = () => { - /* no-op */ - } + store.pushSyncConfig = vi.fn() await store.initSyncConfig({ ...user }) expect(store.cache._version).to.eql(VERSION) expect(store.cache._timestamp).to.be.a('number') @@ -50,10 +47,7 @@ describe('The SyncConfig store', () => { it('should initialize storage with proper flags for new users if none present', async () => { const store = useSyncConfigStore() - // PushSyncConfig is very simple but uses vuex to push data - store.pushSyncConfig = () => { - /* no-op */ - } + store.pushSyncConfig = vi.fn() await store.initSyncConfig({ ...user, created_at: new Date() }) expect(store.cache._version).to.eql(VERSION) expect(store.cache._timestamp).to.be.a('number') @@ -63,10 +57,7 @@ describe('The SyncConfig store', () => { it('should merge flags even if remote timestamp is older', async () => { const store = useSyncConfigStore() - // PushSyncConfig is very simple but uses vuex to push data - store.pushSyncConfig = () => { - /* no-op */ - } + store.pushSyncConfig = vi.fn() store.cache = { _timestamp: Date.now(), _version: VERSION, @@ -96,10 +87,7 @@ describe('The SyncConfig store', () => { it('should trim journal to 500 entries', async () => { const store = useSyncConfigStore() - // PushSyncConfig is very simple but uses vuex to push data - store.pushSyncConfig = () => { - /* no-op */ - } + store.pushSyncConfig = vi.fn() store.cache = { _timestamp: Date.now(), _version: VERSION, @@ -138,10 +126,7 @@ describe('The SyncConfig store', () => { it('should reset local timestamp to remote if contents are the same', async () => { const store = useSyncConfigStore() store.cache = null - // PushSyncConfig is very simple but uses vuex to push data - store.pushSyncConfig = () => { - /* no-op */ - } + store.pushSyncConfig = vi.fn() await store.initSyncConfig({ ...user, @@ -161,10 +146,7 @@ describe('The SyncConfig store', () => { it('should use remote version if local missing', async () => { const store = useSyncConfigStore() - // PushSyncConfig is very simple but uses vuex to push data - store.pushSyncConfig = () => { - /* no-op */ - } + store.pushSyncConfig = vi.fn() await store.initSyncConfig(store, user) expect(store.cache._version).to.eql(VERSION) expect(store.cache._timestamp).to.be.a('number') @@ -208,9 +190,7 @@ describe('The SyncConfig store', () => { }) vi.spyOn(storage, 'setItem').mockResolvedValue() const store = useSyncConfigStore() - store.pushSyncConfig = () => { - /* no-op */ - } + store.pushSyncConfig = vi.fn() await store.initSyncConfig({ ...user, @@ -240,9 +220,7 @@ describe('The SyncConfig store', () => { }) vi.spyOn(storage, 'setItem').mockResolvedValue() const store = useSyncConfigStore() - store.pushSyncConfig = () => { - /* no-op */ - } + store.pushSyncConfig = vi.fn() await store.initSyncConfig({ ...user, @@ -282,9 +260,7 @@ describe('The SyncConfig store', () => { vi.spyOn(storage, 'setItem').mockResolvedValue() const store = useSyncConfigStore() const setPreference = vi.spyOn(store, 'setPreference') - store.pushSyncConfig = () => { - /* no-op */ - } + store.pushSyncConfig = vi.fn() await store.initSyncConfig({ ...user, @@ -318,9 +294,7 @@ describe('The SyncConfig store', () => { }) vi.spyOn(storage, 'setItem').mockResolvedValue() const store = useSyncConfigStore() - store.pushSyncConfig = () => { - /* no-op */ - } + store.pushSyncConfig = vi.fn() await store.initSyncConfig({ ...user, @@ -357,9 +331,7 @@ describe('The SyncConfig store', () => { const localStore = useLocalConfigStore() localStore.set({ path: 'fontInterface', value: 'Current interface' }) const store = useSyncConfigStore() - store.pushSyncConfig = () => { - /* no-op */ - } + store.pushSyncConfig = vi.fn() await store.initSyncConfig({ ...user }) @@ -372,10 +344,7 @@ describe('The SyncConfig store', () => { describe('setPreference', () => { it('should set preference and update journal log accordingly', () => { const store = useSyncConfigStore() - // PushSyncConfig is very simple but uses vuex to push data - store.pushSyncConfig = () => { - /* no-op */ - } + store.pushSyncConfig = vi.fn() store.setPreference({ path: 'simple.palette', value: '1' }) expect(store.prefsStorage.simple.palette).to.eql('1') expect(store.prefsStorage._journal).to.have.length(1) @@ -390,10 +359,7 @@ describe('The SyncConfig store', () => { it('should keep journal to a minimum', () => { const store = useSyncConfigStore() - // PushSyncConfig is very simple but uses vuex to push data - store.pushSyncConfig = () => { - /* no-op */ - } + store.pushSyncConfig = vi.fn() store.setPreference({ path: 'simple.palette', value: 1 }) store.setPreference({ path: 'simple.palette', value: 2 }) store.addCollectionPreference({ path: 'collections.palette', value: 2 }) @@ -423,10 +389,7 @@ describe('The SyncConfig store', () => { it('should remove duplicate entries from journal', () => { const store = useSyncConfigStore() - // PushSyncConfig is very simple but uses vuex to push data - store.pushSyncConfig = () => { - /* no-op */ - } + store.pushSyncConfig = vi.fn() store.setPreference({ path: 'simple.palette', value: 1 }) store.setPreference({ path: 'simple.palette', value: 1 }) store.addCollectionPreference({ path: 'collections.palette', value: 2 }) @@ -440,10 +403,7 @@ describe('The SyncConfig store', () => { // TODO We need a proper test for object-based stores it.skip('should remove depth = 3 set/unset entries from journal', () => { const store = useSyncConfigStore() - // PushSyncConfig is very simple but uses vuex to push data - store.pushSyncConfig = () => { - /* no-op */ - } + store.pushSyncConfig = vi.fn() store.setPreference({ path: 'simple.fontInput', value: 'test' }) store.unsetPreference({ path: 'simple.fontInput' }) store.updateCache(store, { username: 'test' }) @@ -455,10 +415,7 @@ describe('The SyncConfig store', () => { it('should not allow unsetting depth <= 2', () => { const store = useSyncConfigStore() - // PushSyncConfig is very simple but uses vuex to push data - store.pushSyncConfig = () => { - /* no-op */ - } + store.pushSyncConfig = vi.fn() store.setPreference({ path: 'simple.object.foo', value: 1 }) expect(() => store.unsetPreference({ path: 'simple' })).to.throw() expect(() => @@ -468,10 +425,7 @@ describe('The SyncConfig store', () => { it('should not allow (un)setting depth > 3', () => { const store = useSyncConfigStore() - // PushSyncConfig is very simple but uses vuex to push data - store.pushSyncConfig = () => { - /* no-op */ - } + store.pushSyncConfig = vi.fn() store.setPreference({ path: 'simple.object', value: {} }) expect(() => store.setPreference({ path: 'simple.object.lv3', value: 1 }), diff --git a/vite.config.js b/vite.config.js index 7dee680ec..9ebd3a3a5 100644 --- a/vite.config.js +++ b/vite.config.js @@ -120,6 +120,7 @@ export default defineConfig(async ({ mode, command }) => { const swDest = 'sw-pleroma.js' const alias = { src: '/src', + test: '/test', components: '/src/components', ...(mode === 'test' ? { vue: 'vue/dist/vue.esm-bundler.js' } : {}), }