Spaces:
Runtime error
Runtime error
File size: 1,012 Bytes
cd8bd0a | 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 | import { describe, it } from "node:test";
import assert from "node:assert/strict";
describe("Federation Leaderboard Auth", () => {
it("rejects requests without Authorization header", async () => {
const { GET } = await import("../../../src/app/api/gamification/federation/leaderboard/route");
const { NextRequest } = await import("next/server");
const req = new NextRequest("http://localhost/api/gamification/federation/leaderboard");
const response = await GET(req);
assert.equal(response.status, 401);
});
it("rejects requests with invalid bearer token", async () => {
const { GET } = await import("../../../src/app/api/gamification/federation/leaderboard/route");
const { NextRequest } = await import("next/server");
const req = new NextRequest("http://localhost/api/gamification/federation/leaderboard", {
headers: { Authorization: "Bearer invalid-token-12345" },
});
const response = await GET(req);
assert.equal(response.status, 403);
});
});
|