Skip to content

Commit 3f0975d

Browse files
authored
Align OpenAPI with OWASP Spectral rules (#71)
* chore: resolve spectral warnings * chore: update api contact * chore: fix Fettmattis casing * chore: normalize Fettmattis casing * chore: align OpenAPI with OWASP spectral rules
1 parent 11e5807 commit 3f0975d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1261
-424
lines changed

.spectral.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
extends:
22
- spectral:oas
3+
- "@stoplight/spectral-owasp-ruleset"
4+
- ./spectral/owasp-api-governance/.spectral.yaml
35

46
rules:
57
operation-operationId: error

e2e/app-flows.spec.ts

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { loginAsTestUser } from "./helpers/auth";
55

66
type ApiPlayer = components["schemas"]["Player"];
77
type ApiRound = components["schemas"]["Round"];
8-
type ApiFettMattis = components["schemas"]["FettMattis"];
8+
type ApiFettmattis = components["schemas"]["Fettmattis"];
99

1010
const ASTRID = "Astrid Nygaard";
1111
const EMIL = "Emil Kavli";
@@ -141,7 +141,7 @@ test("T037: user can toggle player activity from the roster", async ({
141141
).toBeVisible();
142142
});
143143

144-
test("T037: leaderboard view surfaces regular and FettMattis standings", async ({
144+
test("T037: leaderboard view surfaces regular and Fettmattis standings", async ({
145145
page,
146146
}) => {
147147
await page.goto("/leaderboard", { waitUntil: "domcontentloaded" });
@@ -163,18 +163,18 @@ test("T037: leaderboard view surfaces regular and FettMattis standings", async (
163163
regularTable.getByRole("row", { name: new RegExp(LINA, "i") }),
164164
).toBeVisible();
165165

166-
const fettMattisTable = page.getByRole("table").filter({
166+
const fettmattisTable = page.getByRole("table").filter({
167167
has: page.getByRole("columnheader", {
168-
name: "FettMattis",
168+
name: "Fettmattis",
169169
exact: true,
170170
}),
171171
});
172-
await expect(fettMattisTable).toBeVisible();
172+
await expect(fettmattisTable).toBeVisible();
173173
await expect(
174-
fettMattisTable.getByRole("row", { name: new RegExp(ASTRID, "i") }),
174+
fettmattisTable.getByRole("row", { name: new RegExp(ASTRID, "i") }),
175175
).toBeVisible();
176176
await expect(
177-
fettMattisTable.getByRole("row", { name: new RegExp(LINA, "i") }),
177+
fettmattisTable.getByRole("row", { name: new RegExp(LINA, "i") }),
178178
).toBeVisible();
179179
});
180180

@@ -244,17 +244,17 @@ test("T193: rounds dashboard enforces 24-hour deletion window", async ({
244244
page.locator(`button[aria-controls="round-details-${latestRound.id}"]`),
245245
).toHaveCount(0);
246246

247-
const archivedFettMattisButton = page.locator(
247+
const archivedFettmattisButton = page.locator(
248248
'button[aria-controls="fettmattis-details-30000000-0000-4000-8000-000000000302"]',
249249
);
250-
await expect(archivedFettMattisButton).toBeVisible();
250+
await expect(archivedFettmattisButton).toBeVisible();
251251

252-
const archivedFettMattisRow = page
252+
const archivedFettmattisRow = page
253253
.locator("tr")
254-
.filter({ has: archivedFettMattisButton })
254+
.filter({ has: archivedFettmattisButton })
255255
.first();
256256
await expect(
257-
archivedFettMattisRow.getByRole("button", { name: "Slett" }),
257+
archivedFettmattisRow.getByRole("button", { name: "Slett" }),
258258
).toHaveCount(0);
259259

260260
await page.getByLabel("Spiller").selectOption({ label: LINA });
@@ -263,48 +263,48 @@ test("T193: rounds dashboard enforces 24-hour deletion window", async ({
263263
page.getByText("Fettmattis tildelt. Klar for feiring!"),
264264
).toBeVisible();
265265

266-
const fettMattisResponse = await page.request.get("/api/fettmattis?limit=1");
267-
expect(fettMattisResponse.ok()).toBeTruthy();
268-
const [latestFettMattis] =
269-
(await fettMattisResponse.json()) as ApiFettMattis[];
270-
if (!latestFettMattis) {
266+
const fettmattisResponse = await page.request.get("/api/fettmattis?limit=1");
267+
expect(fettmattisResponse.ok()).toBeTruthy();
268+
const [latestFettmattis] =
269+
(await fettmattisResponse.json()) as ApiFettmattis[];
270+
if (!latestFettmattis) {
271271
throw new Error("Latest Fettmattis entry was not returned after creation.");
272272
}
273273

274-
const latestFettMattisDetailsButton = page
274+
const latestFettmattisDetailsButton = page
275275
.locator(
276-
`button[aria-controls="fettmattis-details-${latestFettMattis.id}"]`,
276+
`button[aria-controls="fettmattis-details-${latestFettmattis.id}"]`,
277277
)
278278
.first();
279-
const latestFettMattisRow = page
279+
const latestFettmattisRow = page
280280
.locator("tr")
281-
.filter({ has: latestFettMattisDetailsButton })
281+
.filter({ has: latestFettmattisDetailsButton })
282282
.first();
283-
await latestFettMattisDetailsButton.click();
283+
await latestFettmattisDetailsButton.click();
284284

285-
const latestFettMattisDetails = page.locator(
286-
`#fettmattis-details-${latestFettMattis.id}`,
285+
const latestFettmattisDetails = page.locator(
286+
`#fettmattis-details-${latestFettmattis.id}`,
287287
);
288-
await expect(latestFettMattisDetails).toBeVisible();
288+
await expect(latestFettmattisDetails).toBeVisible();
289289
await expect(
290-
latestFettMattisDetails.getByText("Spillerstatus"),
290+
latestFettmattisDetails.getByText("Spillerstatus"),
291291
).toBeVisible();
292292
await expect(
293-
latestFettMattisDetails.getByText("Endringsvindu"),
293+
latestFettmattisDetails.getByText("Endringsvindu"),
294294
).toBeVisible();
295295

296-
const latestFettMattisDeleteButton = latestFettMattisRow.getByRole("button", {
296+
const latestFettmattisDeleteButton = latestFettmattisRow.getByRole("button", {
297297
name: "Slett",
298298
});
299-
await expect(latestFettMattisDeleteButton).toBeVisible();
300-
await latestFettMattisDeleteButton.click();
299+
await expect(latestFettmattisDeleteButton).toBeVisible();
300+
await latestFettmattisDeleteButton.click();
301301

302302
await expect(
303303
page.getByText("Fettmattis fjernet. Oversikten er oppdatert."),
304304
).toBeVisible();
305305
await expect(
306306
page.locator(
307-
`button[aria-controls="fettmattis-details-${latestFettMattis.id}"]`,
307+
`button[aria-controls="fettmattis-details-${latestFettmattis.id}"]`,
308308
),
309309
).toHaveCount(0);
310310
});

e2e/landing-page.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,25 @@ test.describe("Landing Page", () => {
3434
name: "De siste rundene",
3535
level: 3,
3636
});
37-
const fettMattisHeading = page.getByRole("heading", {
37+
const fettmattisHeading = page.getByRole("heading", {
3838
name: "Ferske Fettmattiser",
3939
level: 3,
4040
});
4141

4242
await expect(roundsHeading).toBeVisible();
43-
await expect(fettMattisHeading).toBeVisible();
43+
await expect(fettmattisHeading).toBeVisible();
4444

4545
const leaderboardBox = await leaderboardHeading.boundingBox();
4646
const roundsBox = await roundsHeading.boundingBox();
47-
const fettMattisBox = await fettMattisHeading.boundingBox();
47+
const fettmattisBox = await fettmattisHeading.boundingBox();
4848

49-
if (!leaderboardBox || !roundsBox || !fettMattisBox) {
49+
if (!leaderboardBox || !roundsBox || !fettmattisBox) {
5050
throw new Error(
5151
"Unable to determine layout for leaderboard or activity tables.",
5252
);
5353
}
5454

5555
expect(roundsBox.y).toBeGreaterThan(leaderboardBox.y);
56-
expect(fettMattisBox.y).toBeGreaterThan(leaderboardBox.y);
56+
expect(fettmattisBox.y).toBeGreaterThan(leaderboardBox.y);
5757
});
5858
});

e2e/leaderboard-page.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,21 @@ test.describe("Leaderboard Page", () => {
5757
await expect(regularSection).toBeVisible();
5858
});
5959

60-
await test.step("Verify FettMattis leaderboard section", async () => {
60+
await test.step("Verify Fettmattis leaderboard section", async () => {
6161
const fettmattisSection = page
6262
.getByRole("heading", { name: "Fettmattis-utdelinger" })
6363
.locator("..");
6464
await expect(fettmattisSection).toBeVisible();
6565
});
6666

67-
await test.step("Verify FettMattis table structure", async () => {
67+
await test.step("Verify Fettmattis table structure", async () => {
6868
// Wait for the page to fully load
6969
await page.waitForLoadState("networkidle");
7070

7171
const tables = page.getByRole("table");
7272
const tableCount = await tables.count();
7373

74-
// Check if we have a second table (FettMattis) or an empty state message
74+
// Check if we have a second table (Fettmattis) or an empty state message
7575
if (tableCount >= 2) {
7676
const fettmattisTable = tables.nth(1);
7777
await expect(fettmattisTable).toBeVisible();
@@ -82,7 +82,7 @@ test.describe("Leaderboard Page", () => {
8282
fettmattisTable.getByRole("columnheader", { name: "Spiller" }),
8383
).toBeVisible();
8484
await expect(
85-
fettmattisTable.getByRole("columnheader", { name: "FettMattis" }),
85+
fettmattisTable.getByRole("columnheader", { name: "Fettmattis" }),
8686
).toBeVisible();
8787
} else {
8888
// Verify empty state message is shown

0 commit comments

Comments
 (0)