|
1 | 1 | import { NextRequest, NextResponse } from "next/server.js"; |
2 | 2 | import { describe, expect, it } from "vitest"; |
3 | 3 |
|
4 | | -import { isPrefetch, toNextRequest, toNextResponse } from "./next-compat.js"; |
| 4 | +import { toNextRequest, toNextResponse } from "./next-compat.js"; |
5 | 5 |
|
6 | 6 | describe("next-compact", () => { |
7 | 7 | describe("toNextRequest", () => { |
@@ -111,32 +111,4 @@ describe("next-compact", () => { |
111 | 111 | expect(() => toNextResponse(fakeRes)).not.toThrow(); |
112 | 112 | }); |
113 | 113 | }); |
114 | | - |
115 | | - describe("isPrefetch", () => { |
116 | | - it("should detect x-middleware-prefetch header", () => { |
117 | | - const req = new Request("https://example.com", { |
118 | | - headers: { "x-middleware-prefetch": "1" } |
119 | | - }); |
120 | | - expect(isPrefetch(req)).toBe(true); |
121 | | - }); |
122 | | - |
123 | | - it("should detect next-router-prefetch header", () => { |
124 | | - const req = new Request("https://example.com", { |
125 | | - headers: { "next-router-prefetch": "1" } |
126 | | - }); |
127 | | - expect(isPrefetch(req)).toBe(true); |
128 | | - }); |
129 | | - |
130 | | - it("should detect purpose=prefetch header", () => { |
131 | | - const req = new Request("https://example.com", { |
132 | | - headers: { purpose: "prefetch" } |
133 | | - }); |
134 | | - expect(isPrefetch(req)).toBe(true); |
135 | | - }); |
136 | | - |
137 | | - it("should return false when no prefetch-related headers are set", () => { |
138 | | - const req = new Request("https://example.com"); |
139 | | - expect(isPrefetch(req)).toBe(false); |
140 | | - }); |
141 | | - }); |
142 | 114 | }); |
0 commit comments