mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 10:42:44 +00:00
Fix newUserService test after console.log removal
Update test to verify new user status without relying on console.log
This commit is contained in:
@@ -323,9 +323,7 @@ describe('newUserService', () => {
|
|||||||
expect(mockSettingStore.set).toHaveBeenCalledTimes(1)
|
expect(mockSettingStore.set).toHaveBeenCalledTimes(1)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should log new user status', async () => {
|
it('should correctly determine new user status', async () => {
|
||||||
const consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => {})
|
|
||||||
|
|
||||||
mockSettingStore.settingValues = {}
|
mockSettingStore.settingValues = {}
|
||||||
mockSettingStore.get.mockImplementation((key: string) => {
|
mockSettingStore.get.mockImplementation((key: string) => {
|
||||||
if (key === 'Comfy.TutorialCompleted') return undefined
|
if (key === 'Comfy.TutorialCompleted') return undefined
|
||||||
@@ -333,12 +331,19 @@ describe('newUserService', () => {
|
|||||||
})
|
})
|
||||||
mockLocalStorage.getItem.mockReturnValue(null)
|
mockLocalStorage.getItem.mockReturnValue(null)
|
||||||
|
|
||||||
|
// Before initialization, isNewUser should return null
|
||||||
|
expect(service.isNewUser()).toBeNull()
|
||||||
|
|
||||||
await service.initializeIfNewUser(mockSettingStore)
|
await service.initializeIfNewUser(mockSettingStore)
|
||||||
|
|
||||||
expect(consoleSpy).toHaveBeenCalledWith(
|
// After initialization, isNewUser should return true for a new user
|
||||||
'New user status determined: true'
|
expect(service.isNewUser()).toBe(true)
|
||||||
|
|
||||||
|
// Should set the installed version for new users
|
||||||
|
expect(mockSettingStore.set).toHaveBeenCalledWith(
|
||||||
|
'Comfy.InstalledVersion',
|
||||||
|
expect.any(String)
|
||||||
)
|
)
|
||||||
consoleSpy.mockRestore()
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user