Skip to content

Commit

Permalink
fix(build): fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
Red-Asuka authored and ysfscream committed Nov 20, 2024
1 parent 38b170d commit c7fce4a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 26 deletions.
3 changes: 2 additions & 1 deletion apps/desktop/src/renderer/src/pages/settings.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<template>
<SettingsView />
<!-- <SettingsView /> -->
TODO: Implement desktop database settings
</template>
51 changes: 26 additions & 25 deletions packages/ui/src/stores/__test__/useSettings.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// import { beforeEach, describe, expect, it, vi } from 'vitest'
// import { useSettingsStore } from '../useSettingsStore'
import { beforeEach, vi } from 'vitest'
import type { Settings } from 'mqttx'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { useSettingsStore } from '../useSettingsStore'

// Mocking a class for localStorage with all necessary methods
class LocalStorageMock {
Expand Down Expand Up @@ -37,25 +37,26 @@ beforeEach(() => {
vi.clearAllMocks()
})

// TODO: Fix the test
// describe('settingsStore', () => {
// it('should change theme', () => {
// const store = useSettingsStore()
// store.changeTheme('light')
// expect(store.theme).toBe('light')
// })

// it('should change language and update localStorage', () => {
// const store = useSettingsStore()
// store.changeLang('ja')
// expect(store.lang).toBe('ja')
// expect(localStorage.setItem).toHaveBeenCalledWith('lang', 'ja')
// })

// it('should retrieve language from localStorage on initialization', () => {
// localStorage.setItem('lang', 'en')
// const store = useSettingsStore()
// expect(store.lang).toBe('en')
// expect(localStorage.getItem).toHaveBeenCalledWith('lang')
// })
// })
describe('settingsStore', () => {
it('should update settings', () => {
const store = useSettingsStore()
const newSettings: Settings = {
currentLang: 'zh',
autoCheck: true,
autoResub: true,
multiTopics: false,
maxReconnectTimes: 3,
syncOsTheme: true,
currentTheme: 'dark',
jsonHighlight: true,
logLevel: 'debug',
ignoreQoS0Message: false,
enableCopilot: false,
openAIAPIHost: '',
openAIAPIKey: '',
model: '',
}
store.updateSettings(newSettings)
expect(store.settings).toEqual(newSettings)
})
})

0 comments on commit c7fce4a

Please sign in to comment.