summaryrefslogtreecommitdiff
path: root/packages/vercel-optimize-tests/test/framework-support.test.mjs
blob: 053bd78bdca072b349c0993ee10d3d16f45be7be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { test } from 'node:test';
import assert from 'node:assert/strict';
import {
  classifyFrameworkSupport,
  frameworkLabel,
} from '../../../skills/vercel-optimize/lib/framework-support.mjs';

test('classifyFrameworkSupport: core frameworks continue by default', () => {
  for (const framework of ['next', 'sveltekit', 'nuxt']) {
    const r = classifyFrameworkSupport({ framework });
    assert.equal(r.ok, true);
    assert.equal(r.status, 'supported');
    assert.equal(r.blocker, null);
    assert.match(r.detail, /route-to-file/);
  }
});

test('classifyFrameworkSupport: Astro is limited, not a hard blocker', () => {
  const r = classifyFrameworkSupport({ framework: 'astro' });
  assert.equal(r.ok, true);
  assert.equal(r.status, 'limited');
  assert.equal(r.blocker, null);
  assert.match(r.detail, /limited/i);
});

test('classifyFrameworkSupport: Hono blocks metric-backed code recommendations', () => {
  const r = classifyFrameworkSupport({ framework: 'hono' });
  assert.equal(r.ok, false);
  assert.equal(r.status, 'unsupported');
  assert.equal(r.blocker, 'unsupported_framework');
  assert.equal(r.label, 'Hono');
  assert.match(r.detail, /Supported frameworks: Next\.js, SvelteKit, Nuxt/);
});

test('frameworkLabel: normalizes aliases', () => {
  assert.equal(frameworkLabel('nextjs'), 'Next.js');
  assert.equal(frameworkLabel('svelte'), 'SvelteKit');
});