mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
23 lines
952 B
TypeScript
23 lines
952 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
ACTIVITY_WINDOW_MINUTE_OPTIONS,
|
|
ActivityWindowMinutesSchema,
|
|
UserPreferencesSchema,
|
|
} from '@opencode-manager/shared/schemas'
|
|
|
|
describe('ActivityWindowMinutesSchema', () => {
|
|
it.each(ACTIVITY_WINDOW_MINUTE_OPTIONS)('accepts the configured option %s', (minutes) => {
|
|
expect(ActivityWindowMinutesSchema.safeParse(minutes).success).toBe(true)
|
|
})
|
|
|
|
it.each([5, 45, 2000, 30.5])('rejects %s', (minutes) => {
|
|
expect(ActivityWindowMinutesSchema.safeParse(minutes).success).toBe(false)
|
|
})
|
|
|
|
it('rejects a non-option value through UserPreferencesSchema', () => {
|
|
const PreferencesActivityWindowSchema = UserPreferencesSchema.pick({ activityWindowMinutes: true })
|
|
expect(PreferencesActivityWindowSchema.safeParse({ activityWindowMinutes: 45 }).success).toBe(false)
|
|
expect(PreferencesActivityWindowSchema.safeParse({ activityWindowMinutes: 60 }).success).toBe(true)
|
|
})
|
|
})
|