The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
import { expect, it } from 'vitest'
import { useCloudAuthStore } from '../../stores/cloudAuthStore'
import { captureFlashGeneration, recordFlashResponse, useFlashBillingStore } from '../flash-ui'
it('clears notices on account changes and rejects the old in-flight response', () => {
const account = { licenseActive: true, tier: 'test', access: true, quota: null }
useCloudAuthStore.getState().setSignedIn({ id: 'account-a' }, account)
const generation = captureFlashGeneration()
const response = new Response('', { headers: { 'x-lu-chat-billing': 'flash', 'x-lu-flash-remaining': '40000' } })
recordFlashResponse('test', response, generation)
expect(useFlashBillingStore.getState().entries.test).toBeDefined()
useCloudAuthStore.getState().setSignedIn({ id: 'account-b' }, account)
recordFlashResponse('test', response, generation)
expect(useFlashBillingStore.getState().entries).toEqual({})
recordFlashResponse('test', response, captureFlashGeneration())
useCloudAuthStore.getState().setSignedOut()
expect(useFlashBillingStore.getState().entries).toEqual({})
})