fix: require genuine live hosting evidence
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { classifyLiveHostingBaseUrl } from "../../scripts/lib/hosting-probe.mjs";
|
||||
|
||||
describe("live hosting evidence target", () => {
|
||||
it("accepts a canonical production HTTPS root", () => {
|
||||
expect(
|
||||
classifyLiveHostingBaseUrl("https://frontend.example.test/"),
|
||||
).toMatchObject({
|
||||
passed: true,
|
||||
observedOrigin: "https://frontend.example.test",
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
["http://frontend.example.test/", "requires HTTPS"],
|
||||
["https://localhost:4173/", "not live deployment evidence"],
|
||||
["https://127.0.0.1/", "not live deployment evidence"],
|
||||
["https://frontend.example.test/app/", "canonical root URL"],
|
||||
["https://user:secret@frontend.example.test/", "must not contain credentials"],
|
||||
])("rejects %s", (url, reason) => {
|
||||
expect(classifyLiveHostingBaseUrl(url)).toMatchObject({
|
||||
passed: false,
|
||||
reason: expect.stringContaining(reason),
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user