Merged in chore/fix-tests (pull request #3430)

Chore/fix tests

* chore: Upgrade nextjs@16.1.1

* chore: upgrade next@16.1.1

* upgrade underlying types

* merge

* Fix broken tests

* bump @swc/plugin-formatjs to latest version

* bump sentry

* transpile "import-in-the-middle" & "require-in-the-middle"

* revert next@16.1.1 upgrade

* revert transpilation addition

* .
This commit is contained in:
Joakim Jäderberg
2026-01-13 13:48:06 +00:00
parent dba4c81618
commit d284e82828
15 changed files with 334 additions and 157 deletions

View File

@@ -46,9 +46,8 @@ export const Default: Story = {
href: "#",
children: "Button link",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -59,9 +58,8 @@ export const PrimaryLarge: Story = {
variant: "Primary",
size: "lg",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -71,9 +69,8 @@ export const PrimaryMedium: Story = {
...PrimaryLarge.args,
size: "md",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -83,9 +80,8 @@ export const PrimarySmall: Story = {
...PrimaryLarge.args,
size: "sm",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -97,9 +93,8 @@ export const PrimaryOnDarkBackground: Story = {
variant: "Primary",
size: "lg",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -113,9 +108,8 @@ export const PrimaryInvertedLarge: Story = {
size: "lg",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -126,9 +120,8 @@ export const PrimaryInvertedMedium: Story = {
...PrimaryInvertedLarge.args,
size: "md",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -139,9 +132,8 @@ export const PrimaryInvertedSmall: Story = {
...PrimaryInvertedLarge.args,
size: "sm",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -152,9 +144,8 @@ export const SecondaryLarge: Story = {
variant: "Secondary",
size: "lg",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -164,9 +155,8 @@ export const SecondaryMedium: Story = {
...SecondaryLarge.args,
size: "md",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -176,9 +166,8 @@ export const SecondarySmall: Story = {
...SecondaryLarge.args,
size: "sm",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -191,9 +180,8 @@ export const SecondaryInvertedLarge: Story = {
color: "Inverted",
size: "lg",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -204,9 +192,8 @@ export const SecondaryInvertedMedium: Story = {
...SecondaryInvertedLarge.args,
size: "md",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -217,9 +204,8 @@ export const SecondaryInvertedSmall: Story = {
...SecondaryInvertedLarge.args,
size: "sm",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -230,9 +216,8 @@ export const TertiaryLarge: Story = {
variant: "Tertiary",
size: "lg",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -242,9 +227,8 @@ export const TertiaryMedium: Story = {
...TertiaryLarge.args,
size: "md",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -254,9 +238,8 @@ export const TertiarySmall: Story = {
...TertiaryLarge.args,
size: "sm",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -267,9 +250,8 @@ export const TextLarge: Story = {
variant: "Text",
size: "lg",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -279,9 +261,8 @@ export const TextMedium: Story = {
...TextLarge.args,
size: "md",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -291,9 +272,8 @@ export const TextSmall: Story = {
...TextLarge.args,
size: "sm",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -304,9 +284,8 @@ export const TextNoWrapping: Story = {
children: "Text button with wrapping false",
wrapping: false,
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -319,9 +298,8 @@ export const TextInvertedLarge: Story = {
color: "Inverted",
size: "lg",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -332,9 +310,8 @@ export const TextInvertedMedium: Story = {
...TextInvertedLarge.args,
size: "md",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -345,9 +322,8 @@ export const TextInvertedSmall: Story = {
...TextInvertedLarge.args,
size: "sm",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}
@@ -359,9 +335,8 @@ export const TextWithIcon: Story = {
children: "Text with icon",
trailingIconName: "chevron_right",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link", { name: /Text with icon/i })
expect(link).toBeInTheDocument()
},
}
@@ -372,9 +347,8 @@ export const TextWithIconInverted: Story = {
...TextWithIcon.args,
color: "Inverted",
},
play: async ({ canvasElement }) => {
const link = canvasElement.querySelector("a")
if (!link) throw new Error("Link not found")
play: async ({ canvas }) => {
const link = await canvas.findByRole("link")
expect(link).toBeInTheDocument()
},
}