|
1 | 1 | import { describe, it } from "vitest"; |
2 | | -import { getFrameworkClass } from "../../../autoconfig/frameworks"; |
| 2 | +import { getFrameworkClassInstance } from "../../../autoconfig/frameworks"; |
3 | 3 | import { NextJs } from "../../../autoconfig/frameworks/next"; |
| 4 | +import { NoOpFramework } from "../../../autoconfig/frameworks/no-op"; |
4 | 5 | import { Static } from "../../../autoconfig/frameworks/static"; |
5 | 6 |
|
6 | | -describe("getFrameworkClass()", () => { |
| 7 | +describe("getFrameworkClassInstance()", () => { |
7 | 8 | it("should return a Static framework when frameworkId is unknown", ({ |
8 | 9 | expect, |
9 | 10 | }) => { |
10 | | - const framework = getFrameworkClass("unknown-framework"); |
| 11 | + const framework = getFrameworkClassInstance("unknown-framework"); |
11 | 12 |
|
12 | 13 | expect(framework).toBeInstanceOf(Static); |
13 | 14 | expect(framework.id).toBe("static"); |
14 | 15 | expect(framework.name).toBe("Static"); |
15 | 16 | }); |
16 | 17 |
|
17 | | - it("should return a target framework when frameworkId is known", ({ |
| 18 | + it("should return a target framework when frameworkId is known and supported", ({ |
18 | 19 | expect, |
19 | 20 | }) => { |
20 | | - const framework = getFrameworkClass("next"); |
| 21 | + const framework = getFrameworkClassInstance("next"); |
21 | 22 |
|
22 | 23 | expect(framework).toBeInstanceOf(NextJs); |
23 | 24 | expect(framework.id).toBe("next"); |
24 | 25 | expect(framework.name).toBe("Next.js"); |
25 | 26 | }); |
| 27 | + |
| 28 | + it("should return a NoOpFramework for an unsupported framework (hono)", ({ |
| 29 | + expect, |
| 30 | + }) => { |
| 31 | + const framework = getFrameworkClassInstance("hono"); |
| 32 | + |
| 33 | + expect(framework).toBeInstanceOf(NoOpFramework); |
| 34 | + expect(framework.id).toBe("hono"); |
| 35 | + expect(framework.name).toBe("Hono"); |
| 36 | + }); |
26 | 37 | }); |
0 commit comments