2026-06-02 00:43:05 +03:00
|
|
|
import { afterEach, describe, expect, it, vi } from 'vitest';
|
2026-04-30 13:07:37 +03:00
|
|
|
|
|
|
|
|
import { createNotificationTemplateRuntime } from './template-runtime.js';
|
|
|
|
|
|
2026-06-02 00:43:05 +03:00
|
|
|
const originalFetch = globalThis.fetch;
|
|
|
|
|
|
2026-04-30 13:07:37 +03:00
|
|
|
const createRuntime = (settings = {}) => createNotificationTemplateRuntime({
|
|
|
|
|
readSettingsFromDisk: async () => settings,
|
|
|
|
|
persistSettings: vi.fn(async () => {}),
|
|
|
|
|
buildOpenCodeUrl: (path) => path,
|
|
|
|
|
getOpenCodeAuthHeaders: () => ({}),
|
|
|
|
|
resolveGitBinaryForSpawn: () => 'git',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('notification template runtime zen models', () => {
|
2026-06-02 00:43:05 +03:00
|
|
|
afterEach(() => {
|
|
|
|
|
globalThis.fetch = originalFetch;
|
|
|
|
|
});
|
|
|
|
|
|
2026-05-19 02:06:52 +03:00
|
|
|
it('returns no selectable zen models after provider retirement', async () => {
|
2026-04-30 13:07:37 +03:00
|
|
|
const runtime = createRuntime();
|
|
|
|
|
const models = await runtime.fetchFreeZenModels();
|
|
|
|
|
|
2026-05-19 02:06:52 +03:00
|
|
|
expect(models).toEqual([]);
|
2026-04-30 13:07:37 +03:00
|
|
|
});
|
|
|
|
|
|
2026-05-19 02:06:52 +03:00
|
|
|
it('preserves stored zen model value for compatibility without validation', async () => {
|
2026-04-30 13:07:37 +03:00
|
|
|
const runtime = createRuntime({ zenModel: 'trinity-large-preview-free' });
|
|
|
|
|
|
2026-05-19 02:06:52 +03:00
|
|
|
await expect(runtime.resolveZenModel()).resolves.toBe('trinity-large-preview-free');
|
2026-04-30 13:07:37 +03:00
|
|
|
});
|
|
|
|
|
});
|