Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/composables/queue/useJobList.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,6 @@ describe('useJobList', () => {
})

it('groups terminal jobs without an execution end timestamp by create time', async () => {
vi.setSystemTime(new Date('2024-01-10T12:00:00Z'))
queueStoreMock.historyTasks = [
createTask({
jobId: 'failed-before-execution',
Expand Down Expand Up @@ -583,7 +582,6 @@ describe('useJobList', () => {
})

it('groups job items by date label and sorts by total generation time when requested', async () => {
vi.setSystemTime(new Date('2024-01-10T12:00:00Z'))
queueStoreMock.historyTasks = [
createTask({
jobId: 'today-small',
Expand Down
41 changes: 22 additions & 19 deletions src/composables/queue/useQueueNotificationBanners.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ describe(useQueueNotificationBanners, () => {
}

beforeEach(() => {
vi.setSystemTime(0)
resetState()
})

Expand Down Expand Up @@ -204,14 +203,15 @@ describe(useQueueNotificationBanners, () => {

it('shows a completed notification from a finished batch', async () => {
const { unmount, composable } = mountComposable()
const now = Date.now()

try {
await runBatch({
start: 1_000,
finish: 1_200,
start: now + 1_000,
finish: now + 1_200,
tasks: [
createTask({
ts: 1_050,
ts: now + 1_050,
previewUrl: 'https://example.com/preview.png'
})
]
Expand All @@ -229,13 +229,14 @@ describe(useQueueNotificationBanners, () => {

it('shows one completion notification when history updates after queue becomes idle', async () => {
const { unmount, composable } = mountComposable()
const now = Date.now()

try {
vi.setSystemTime(4_000)
vi.setSystemTime(now + 4_000)
executionStore().isIdle = false
await nextTick()

vi.setSystemTime(4_100)
vi.setSystemTime(now + 4_100)
executionStore().isIdle = true
queueStore().historyTasks = []
await nextTick()
Expand All @@ -244,7 +245,7 @@ describe(useQueueNotificationBanners, () => {

queueStore().historyTasks = [
createTask({
ts: 4_050,
ts: now + 4_050,
previewUrl: 'https://example.com/race-preview.png'
})
]
Expand All @@ -270,19 +271,20 @@ describe(useQueueNotificationBanners, () => {

it('queues both completed and failed notifications for mixed batches', async () => {
const { unmount, composable } = mountComposable()
const now = Date.now()

try {
await runBatch({
start: 2_000,
finish: 2_200,
start: now + 2_000,
finish: now + 2_200,
tasks: [
createTask({
ts: 2_050,
ts: now + 2_050,
previewUrl: 'https://example.com/result.png'
}),
createTask({ ts: 2_060 }),
createTask({ ts: 2_070 }),
createTask({ state: 'Failed', ts: 2_080 })
createTask({ ts: now + 2_060 }),
createTask({ ts: now + 2_070 }),
createTask({ state: 'Failed', ts: now + 2_080 })
]
})

Expand All @@ -306,26 +308,27 @@ describe(useQueueNotificationBanners, () => {

it('uses up to two completion thumbnails for notification icon previews', async () => {
const { unmount, composable } = mountComposable()
const now = Date.now()

try {
await runBatch({
start: 3_000,
finish: 3_300,
start: now + 3_000,
finish: now + 3_300,
tasks: [
createTask({
ts: 3_050,
ts: now + 3_050,
previewUrl: 'https://example.com/preview-1.png'
}),
createTask({
ts: 3_060,
ts: now + 3_060,
previewUrl: 'https://example.com/preview-2.png'
}),
createTask({
ts: 3_070,
ts: now + 3_070,
previewUrl: 'https://example.com/preview-3.png'
}),
createTask({
ts: 3_080,
ts: now + 3_080,
previewUrl: 'https://example.com/preview-4.png'
})
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,7 @@ describe('useMediaAssetFiltering', () => {
})

it('combines media type and date before sorting', () => {
const now = new Date(2026, 6, 27, 12).getTime()
vi.setSystemTime(now)
const now = Date.now()

const assets = ref<AssetItem[]>([
makeAsset({
Expand Down
1 change: 0 additions & 1 deletion src/platform/surveys/NightlySurveyPopover.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ describe('NightlySurveyPopover', () => {
beforeEach(() => {
localStorage.clear()
vi.resetModules()
vi.setSystemTime(new Date('2024-06-15T12:00:00Z'))

mockIsNightly.value = true
mockIsCloud.value = false
Expand Down
5 changes: 2 additions & 3 deletions src/platform/surveys/useFeatureUsageTracker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ describe('useFeatureUsageTracker', () => {
})

it('sets firstUsed only on first use', () => {
const firstTs = 1000000
vi.setSystemTime(firstTs)
const firstTs = Date.now()
const { usage, trackUsage } = useFeatureUsageTracker('test-feature-3')

trackUsage()
expect(usage.value?.firstUsed).toBe(firstTs)

vi.setSystemTime(firstTs + 5000)
vi.advanceTimersByTime(5_000)
trackUsage()
expect(usage.value?.firstUsed).toBe(firstTs)
})
Expand Down
1 change: 0 additions & 1 deletion src/platform/surveys/useSurveyEligibility.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ describe('useSurveyEligibility', () => {

beforeEach(() => {
localStorage.clear()
vi.setSystemTime(new Date('2024-06-15T12:00:00Z'))

mockDistribution.isNightly = true
mockDistribution.isCloud = false
Expand Down
1 change: 0 additions & 1 deletion src/platform/telemetry/topupTracker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ vi.mock('@/platform/telemetry', () => ({

describe('topupTracker', () => {
beforeEach(() => {
vi.setSystemTime(new Date('2026-08-07T12:00:00Z'))
localStorage.clear()
})

Expand Down
23 changes: 7 additions & 16 deletions src/platform/updates/common/versionCompatibilityStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,7 @@ describe('useVersionCompatibilityStore', () => {

describe('dismissal persistence', () => {
it('should save dismissal to reactive storage with expiration', async () => {
const mockNow = 1000000
vi.setSystemTime(mockNow)
const now = Date.now()

mockSystemStatsStore.systemStats = {
system: {
Expand All @@ -290,7 +289,7 @@ describe('useVersionCompatibilityStore', () => {

// Check that the dismissal was added to reactive storage
expect(mockDismissalStorage.value).toEqual({
'1.24.0-1.25.0-1.25.0': mockNow + 7 * 24 * 60 * 60 * 1000
'1.24.0-1.25.0-1.25.0': now + 7 * 24 * 60 * 60 * 1000
})
})

Expand Down Expand Up @@ -481,8 +480,7 @@ describe('useVersionCompatibilityStore', () => {
})

it('should include outdated packages in dismissal key', async () => {
const mockNow = 1000000
vi.setSystemTime(mockNow)
const now = Date.now()

mockSystemStatsStore.systemStats = {
system: {
Expand All @@ -504,14 +502,11 @@ describe('useVersionCompatibilityStore', () => {

expect(mockDismissalStorage.value).toEqual({
'1.24.0-1.24.0-1.24.0-comfyui-workflow-templates@0.9.0->0.9.5':
mockNow + 7 * 24 * 60 * 60 * 1000
now + 7 * 24 * 60 * 60 * 1000
})
})

it('should produce the same dismissal key regardless of package order', async () => {
const mockNow = 1000000
vi.setSystemTime(mockNow)

const packageA = {
name: 'comfy-aimdo',
installed: '0.1.0',
Expand Down Expand Up @@ -551,12 +546,11 @@ describe('useVersionCompatibilityStore', () => {
})

it('should prune expired dismissals when writing a new one', async () => {
const mockNow = 10_000_000
vi.setSystemTime(mockNow)
const now = Date.now()

mockDismissalStorage.value = {
'expired-key': mockNow - 1,
'still-valid-key': mockNow + 5000
'expired-key': now - 1,
'still-valid-key': now + 5000
}

mockSystemStatsStore.systemStats = {
Expand All @@ -575,9 +569,6 @@ describe('useVersionCompatibilityStore', () => {
})

it('should allow dismissal when only package warnings are present', async () => {
const mockNow = 1000000
vi.setSystemTime(mockNow)

mockSystemStatsStore.systemStats = {
system: {
comfyui_version: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ describe('useWorkflowPersistenceV2', () => {
}> = []

beforeEach(() => {
vi.setSystemTime(new Date('2025-01-01T00:00:00Z'))
setActivePinia(createTestingPinia({ stubActions: false }))
localStorage.clear()
sessionStorage.clear()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,20 @@ describe('workflowDraftStoreV2', () => {
it('keeps payload updatedAt stable when only recency is refreshed', () => {
const store = useWorkflowDraftStoreV2()

vi.setSystemTime(new Date('2026-03-21T10:00:00Z'))
store.saveDraft('workflows/a.json', '{"id":"a"}', {
name: 'a',
isTemporary: true
})
const initialUpdatedAt = store.getDraft('workflows/a.json')!.updatedAt

vi.setSystemTime(new Date('2026-03-21T10:01:00Z'))
vi.advanceTimersByTime(60_000)
store.saveDraft('workflows/b.json', '{"id":"b"}', {
name: 'b',
isTemporary: true
})
expect(store.getMostRecentPath()).toBe('workflows/b.json')

vi.setSystemTime(new Date('2026-03-21T10:02:00Z'))
vi.advanceTimersByTime(60_000)
store.markDraftUsed('workflows/a.json')

expect(store.getDraft('workflows/a.json')!.updatedAt).toBe(
Expand Down Expand Up @@ -212,14 +211,13 @@ describe('workflowDraftStoreV2', () => {
it('preserves payload updatedAt when moving a draft', () => {
const store = useWorkflowDraftStoreV2()

vi.setSystemTime(new Date('2026-05-13T00:00:00Z'))
store.saveDraft('workflows/old.json', '{"data":"test"}', {
name: 'old',
isTemporary: true
})
const originalUpdatedAt = store.getDraft('workflows/old.json')!.updatedAt

vi.setSystemTime(new Date('2026-05-13T00:05:00Z'))
vi.advanceTimersByTime(5 * 60_000)
store.moveDraft('workflows/old.json', 'workflows/new.json', 'new')

expect(store.getDraft('workflows/new.json')!.updatedAt).toBe(
Expand Down
2 changes: 1 addition & 1 deletion src/platform/workspace/stores/useWorkspaceAuth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const mockWorkspaceWithRole = {

const mockTokenResponse = {
token: 'workspace-token-abc',
expires_at: new Date(Date.now() + 3600 * 1000).toISOString(),
expires_at: new Date('2024-06-15T13:00:00Z').toISOString(),
workspace: mockWorkspace,
role: 'owner' as const,
permissions: ['owner:*']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,6 @@ describe('useImagePreviewWidget', () => {

describe('drawWidget — upload spinner', () => {
it('renders spinner when node.isUploading is true', () => {
vi.setSystemTime(500)

const constructor = useImagePreviewWidget()
const node = createMockNode({ isUploading: true })
constructor(node, defaultInputSpec)
Expand All @@ -217,8 +215,6 @@ describe('useImagePreviewWidget', () => {
})

it('uses LiteGraph.NODE_TEXT_COLOR for spinner stroke', () => {
vi.setSystemTime(0)

const constructor = useImagePreviewWidget()
const node = createMockNode({ isUploading: true })
constructor(node, defaultInputSpec)
Expand Down
Loading
Loading